Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function json_decode($json)
- {
- $comment = false;
- $out = '$x=';
- for ($i=0; $i<strlen($json); $i++)
- {
- if (!$comment)
- {
- if ($json[$i] == '{') $out .= ' array(';
- else if ($json[$i] == '}') $out .= ')';
- else if ($json[$i] == ':') $out .= '=>';
- else $out .= $json[$i];
- }
- else $out .= $json[$i];
- if ($json[$i] == '"') $comment = !$comment;
- }
- eval($out . ';');
- return $x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement