Hi,

JSON allows extensions. I can not understand why this is not an extension that makes sense:

json_encode($var, $allowScalar = false);

In PHP outputting of JS literals is a common action, so all you'll achieve by completely removing this option, is forcing people to go from this:

echo 'var foo = '.json_encode("hello world");

...to this:

echo 'var foo = '.substr(json_encode(array("hi world")), 1, -1);

A flag that defaults to false would be just as explicit and educational, and more efficient, than forcing hacks on us like the above one.

Regards,
Stan Vassilev

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to