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)); /* $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/XpY6t
function name:  (null)
number of ops:  32
compiled vars:  !0 = $text, !1 = $arr, !2 = $utf, !3 = $utfarr, !4 = $json, !5 = $utfjson
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, 'hey+%A0'
   21     1        INIT_ARRAY                                       ~7      !0, 'damnit'
          2        ASSIGN                                                   !1, ~7
   22     3        INIT_FCALL                                               'utf8_encode'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !2, $9
   23     7        INIT_ARRAY                                       ~11     !2, 'damnit'
          8        ASSIGN                                                   !3, ~11
   24     9        INIT_FCALL                                               'json_encode'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $13     
         12        ASSIGN                                                   !4, $13
   25    13        INIT_FCALL                                               'json_encode'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $15     
         16        ASSIGN                                                   !5, $15
   26    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !4
         19        SEND_VAR                                                 !5
         20        DO_ICALL                                                 
   27    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'json_decode'
         23        SEND_VAR                                                 !4
         24        DO_ICALL                                         $18     
         25        SEND_VAR                                                 $18
         26        INIT_FCALL                                               'json_decode'
         27        SEND_VAR                                                 !5
         28        DO_ICALL                                         $19     
         29        SEND_VAR                                                 $19
         30        DO_ICALL                                                 
   38    31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.41 ms | 1396 KiB | 21 Q