ok i do have this small helper function
public static function toJSON($arr){
$json = json_encode($arr);
return preg_replace_callback('/(?<=:)"function((?:(?!}").)*}"/',
function($string){
return str_replace(array('\"','/','"','n','t'),array('"','/','"','',''),substr($string[0],1,-1));
},$json);
}
now what i did there was i created a anonymous function for the callback of preg_replace_callback() function, i checked 3 times already if i missed a single parentheses but my IDE(zend studio) seems not to show any unclosed parentheses.
my error is this
preg_replace_callback() Compilation failed: missing ) at offset 30 (X:\xampp\htdocs\aya\protected\xxx\xxxArray.php:180
where i got wrong?
NOTE: the purpose of this small helper function is to let me create anonymous function inside my json output. if you can recommend me a much better script it would be a big help for me..