3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $someFoo = '{ "Foo" : "Bar" }'; $someFoo = mb_convert_encoding($someFoo, 'ASCII'); echo mb_detect_encoding($someFoo); var_dump(json_decode($someFoo)); $someFoo = mb_convert_encoding($someFoo, 'UTF-8'); echo mb_detect_encoding($someFoo); var_dump(json_decode($someFoo));
based on Wn76a
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/qTHdQ
function name:  (null)
number of ops:  32
compiled vars:  !0 = $someFoo
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   ASSIGN                                                   !0, '%7B+%22Foo%22+%3A+%22Bar%22+%7D'
   4     1        INIT_FCALL                                               'mb_convert_encoding'
         2        SEND_VAR                                                 !0
         3        SEND_VAL                                                 'ASCII'
         4        DO_ICALL                                         $2      
         5        ASSIGN                                                   !0, $2
   5     6        INIT_FCALL                                               'mb_detect_encoding'
         7        SEND_VAR                                                 !0
         8        DO_ICALL                                         $4      
         9        ECHO                                                     $4
   6    10        INIT_FCALL                                               'var_dump'
        11        INIT_FCALL                                               'json_decode'
        12        SEND_VAR                                                 !0
        13        DO_ICALL                                         $5      
        14        SEND_VAR                                                 $5
        15        DO_ICALL                                                 
   8    16        INIT_FCALL                                               'mb_convert_encoding'
        17        SEND_VAR                                                 !0
        18        SEND_VAL                                                 'UTF-8'
        19        DO_ICALL                                         $7      
        20        ASSIGN                                                   !0, $7
   9    21        INIT_FCALL                                               'mb_detect_encoding'
        22        SEND_VAR                                                 !0
        23        DO_ICALL                                         $9      
        24        ECHO                                                     $9
  10    25        INIT_FCALL                                               'var_dump'
        26        INIT_FCALL                                               'json_decode'
        27        SEND_VAR                                                 !0
        28        DO_ICALL                                         $10     
        29        SEND_VAR                                                 $10
        30        DO_ICALL                                                 
        31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.2.0