-------- Původní zpráva --------
Předmět: [PHP-DEV] Removing basic types from our JSON parser
Od: theta...@php.net (Uwe Schindler)
Komu:
Datum: 14.12.2008 10:40

<script>
var foo = <?php echo json_encode($foo)?>;
</script>

will always work.  The only question is what sort of variable foo will
end up being.  The RFC says we have to wrap basic types in an array or
object, while currently we let the basic types through without the
wrapper.

He problem her eis: A lot of people use in a way and assume, that a basic
type is serialized as a basic type in JSON/JS. If we change this, it could
break a lot of apps.

+1

In PHP there is no function for escaping JS strings and json_encode is useful compensation. I use it this way very often.


David Grudl

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

Reply via email to