3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Source: https://bugs.php.net/bug.php?id=63898 /* $key = utf8_encode("Foo " . chr(163)); $array = array($key => ""); var_dump($array); $json = json_encode($array); var_dump($json); $array2 = array($key); var_dump($array2, json_encode($array2)); var_dump(json_encode(utf8_encode('hey now ' . chr(180) . ' you’re dumb'))); var_dump(json_encode('hey now ' . chr(180) . ' you’re dumb')); */ /* $text = 'hey ' . chr(160); $arr = array('damnit' => $text); $utf = utf8_encode($text); $utfarr = array('damnit' => $utf); $json = json_encode($arr); $utfjson = json_encode($utfarr); var_dump($json, $utfjson); var_dump(json_decode($json), json_decode($utfjson)); */ //$v = array('hey' => 'yo', 'bad' => 'guy ' . chr(160)); //$v = array('hey' => 'yo', 'bad' => 'Audio Pass: Get live NFL game audio while you’re on the road with Audio Pass.'); $v = new stdClass(); $v->hey = 'yo'; //$v->bad = 'guy ' . chr(160); $v->bad = 'Audio Pass: Get live NFL game audio while you’re on the road with Audio Pass.'; $json1 = json_encode($v); var_dump($v, $json1, json_decode($json1, false)); /* $x = 'Audio Pass: Get live NFL game audio while you’re on the road with Audio Pass.'; var_dump(htmlentities($x)); var_dump(htmlentities($x, ENT_COMPAT | ENT_SUBSTITUTE, 'ISO-8859-1')); var_dump(htmlentities($x, ENT_COMPAT | ENT_SUBSTITUTE, 'UTF-8')); */
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7dL5W
function name:  (null)
number of ops:  21
compiled vars:  !0 = $v, !1 = $json1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $2      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   35     3        ASSIGN_OBJ                                               !0, 'hey'
          4        OP_DATA                                                  'yo'
   37     5        ASSIGN_OBJ                                               !0, 'bad'
          6        OP_DATA                                                  'Audio+Pass%3A+Get+live+NFL+game+audio+while+you%E2%80%99re+on+the+road+with+Audio+Pass.'
   38     7        INIT_FCALL                                               'json_encode'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !1, $7
   39    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !1
         14        INIT_FCALL                                               'json_decode'
         15        SEND_VAR                                                 !1
         16        SEND_VAL                                                 <false>
         17        DO_ICALL                                         $9      
         18        SEND_VAR                                                 $9
         19        DO_ICALL                                                 
   50    20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.83 ms | 1395 KiB | 19 Q