Guest User

Untitled

a guest
Dec 18th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. function custom_json_decode($json)
  2. {
  3. $comment = false;
  4. $out = '$x=';
  5. for ($i=0; $i<strlen($json); $i++) {
  6. if (!$comment) {
  7. if (($json[$i] == '{') || ($json[$i] == '[')) $out .= ' array('; else if (($json[$i] == '}') || ($json[$i] == ']')) $out .= ')'; else if ($json[$i] == ':') $out .= '=>';
  8. else
  9. $out .= $json[$i];
  10. }
  11. else
  12. $out .= $json[$i];
  13. if ($json[$i] == '"' && $json[($i-1)]!="\")
  14. $comment = !$comment;
  15. }
  16. eval($out . ';');
  17. return $x;
  18. }
  19.  
  20. custom_json_decode($data);
Add Comment
Please, Sign In to add comment