I need to encode a javascript function into a JSON object in PHP.
This:
$function = "function(){}";
$message = "Hello";
$json = array(
'message' => $message,
'func' => $function
);
echo json_encode($json);
outputs:
{"message":"Hello","func":"function(){}"}
What I want is:
{"message":"Hello","func":function(){}}
Can I do this with json_encode?