note 96955 added to function.json-encode

From: Date: Wed, 24 Mar 2010 21:49:40 +0000
Subject: note 96955 added to function.json-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-167363@lists.php.net to get a copy of this message
RE: spam at dvlpt dot com While it is true that eval() is often poorly, JSON is one case where it is exactly what you need. eval() is NOT slow when it is used to turn a JSON string into a useable object. If you don't believe you can look at the jQuery source. The line they use is: data = window['eval']('(' + data + ')'); which is effectively an eval(). The only reason to not use eval() directly is to perform validation on a JSON string. If the string comes from a server that you trust (ie. one you control), eval() is the method to use. ---- Server IP: 69.147.83.197 Probable Submitter: 96.20.185.205 ---- Manual Page -- http://www.php.net/manual/en/function.json-encode.php Edit -- https://master.php.net/note/edit/96955 Del: integrated -- https://master.php.net/note/delete/96955/integrated Del: useless -- https://master.php.net/note/delete/96955/useless Del: bad code -- https://master.php.net/note/delete/96955/bad+code Del: spam -- https://master.php.net/note/delete/96955/spam Del: non-english -- https://master.php.net/note/delete/96955/non-english Del: in docs -- https://master.php.net/note/delete/96955/in+docs Del: other reasons-- https://master.php.net/note/delete/96955 Reject -- https://master.php.net/note/reject/96955 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167363) next »