You might want to use JSON for this, it's really simple to use in both PHP (check json_encode()) and JavaScript.
It's safe to use within
-Tags and browsers which understand JavaScript. Note that the PHP function doesn't encode <
and >
.
Some example PHP:
$user = (object) array("name"=>"Joseph", "age"=>29, "email"=>"asdf@example.net");
echo '';