note 100740 added to function.json-decode

From: Date: Wed, 03 Nov 2010 21:22:47 +0000
Subject: note 100740 added to function.json-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-173724@lists.php.net to get a copy of this message
to deal with escaped dbl-quotes this is required: if ($json[$i] == '"' && $json[($i-1)]!="\\") $comment = !$comment; revision is as follows: <?php if ( !function_exists('json_decode') ){ function json_decode($json) { $comment = false; $out = '$x='; for ($i=0; $i<strlen($json); $i++) { if (!$comment) { if (($json[$i] == '{') || ($json[$i] == '[')) $out .= ' array('; else if (($json[$i] == '}') || ($json[$i] == ']')) $out .= ')'; else if ($json[$i] == ':') $out .= '=>'; else $out .= $json[$i]; } else $out .= $json[$i]; if ($json[$i] == '"' && $json[($i-1)]!="\\") $comment = !$comment; } eval($out . ';'); return $x; } } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 74.219.190.234 ---- Manual Page -- http://www.php.net/manual/en/function.json-decode.php Edit -- https://master.php.net/note/edit/100740 Del: integrated -- https://master.php.net/note/delete/100740/integrated Del: useless -- https://master.php.net/note/delete/100740/useless Del: bad code -- https://master.php.net/note/delete/100740/bad+code Del: spam -- https://master.php.net/note/delete/100740/spam Del: non-english -- https://master.php.net/note/delete/100740/non-english Del: in docs -- https://master.php.net/note/delete/100740/in+docs Del: other reasons-- https://master.php.net/note/delete/100740 Reject -- https://master.php.net/note/reject/100740 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#173724) next »