Parse error: syntax error, unexpected T_FUNCTION line 10?

The error is likely caused by return preg_replace_callback($e, function($v) use ($s,$r) { return $r[$v[1]]; },$sql); Chances are you’re using PHP 5.2 or earlier, which doesn’t support closures. You can find out which version of PHP you’re using phpinfo(). You’ll likely either need to upgrade to PHP 5.3+, or use create_function, or write a static function … Read more

parsererror after jQuery.ajax request with jsonp content type

JSONP requires that the response be wrapped in some kind of callback function, because it works by injecting a script tag into the document as a mechanism to load data from another domain. Essentially, what happens is a script tag gets dynamically inserted into the document like so: <script src=”http://the.other.server.com/foo?callback=someFn”></script> callback is dependent on the … Read more

PHP : Custom error handler – handling parse & fatal errors

Actually you can handle parse and fatal errors. It is true that the error handler function you defined with set_error_handler() will not be called. The way to do it is by defining a shutdown function with register_shutdown_function(). Here is what I have working in my website: File prepend.php (this file will be prepended to all … Read more