Please correct the code for PHP5.3
-
Hello
v 2.2.7 on PHP5.3 (using on Denwer server and old WP)
Parse error: syntax error, unexpected ‘[‘, expecting ‘)’ in …\wp-content\plugins\collapsing-categories\collapscat.php on line 98
collapsing-categories\collapscat.php on line 98
public static function phpArrayToJS($array,$name) { /* generates javscript code to create an array from a php array */ $script = "try { $name" . "['catTest'] = 'test'; } catch (err) { $name = new Object(); }\n"; foreach ($array as $key => $value){ $script .= $name . "['$key'] = '" . addslashes( str_replace( ["\n", "\r"], '', $value ) ) . "';\n"; } return($script); }
Please make so:
addslashes( str_replace( array("\n", "\r"), '', $value ) ) . "';\n";
- The topic ‘Please correct the code for PHP5.3’ is closed to new replies.