How to detect a syntax error in PHP?

This question already has an answer here:

  • Interpolation (double quoted string) of Associative Arrays in PHP 4 answers

  • 有了数组和函数,你需要把curley括号:

    $jsql_ae3 = mysql_query("select products.formats from products where products.id='{$jrowa2['id']}'") or die(mysql_error());
    

    When you use an array like this

    $jrowa2['id']
    

    inside a string with double quotes, PHP you do interpolation and try to interpret it, but, in this case, you can't use the simple quotes surrounding the key, you just have write the key (because it's already inside a string), then, you just use

    $jrowa2[id]
    

    Using a PHP IDE with syntax highlighting such as NetBeans or PHPStorm.

    In this particular case, you can insert a pair of brackets between the single quotes and the array access to fix this line:

    $jsql_ae3 = mysql_query("select products.formats from products where products.id='{$jrowa2['id']}'") or die(mysql_error());
    
    链接地址: http://www.djcxy.com/p/12048.html

    上一篇: Python List Comprehension Vs. 地图

    下一篇: 如何检测PHP中的语法错误?