3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Dummy implements JsonSerializable{ public function jsonSerialize() { global $flag; if ($flag) { exit; } else { return "xxxx"; } } } $array = array(new Dummy()); $array[] = "xxx"; register_shutdown_function(function() use($array) { global $flag; $flag = 0; var_dump(json_encode(array($array))); }); $flag = 1; var_dump(json_encode(array($array)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uSSZ6
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'dummy'
   14     1        NEW                                              $2      'Dummy'
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~4      $2
          4        ASSIGN                                                   !0, ~4
   15     5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  'xxx'
   17     7        INIT_FCALL                                               'register_shutdown_function'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FuSSZ6%3A17%241'
          9        BIND_LEXICAL                                             ~7, !0
   21    10        SEND_VAL                                                 ~7
         11        DO_ICALL                                                 
   23    12        ASSIGN                                                   !1, 1
   24    13        INIT_FCALL                                               'var_dump'
         14        INIT_FCALL                                               'json_encode'
         15        INIT_ARRAY                                       ~10     !0
         16        SEND_VAL                                                 ~10
         17        DO_ICALL                                         $11     
         18        SEND_VAR                                                 $11
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FuSSZ6%3A17%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uSSZ6
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $array, !1 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   BIND_STATIC                                              !0
   18     1        BIND_GLOBAL                                              !1, 'flag'
   19     2        ASSIGN                                                   !1, 0
   20     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'json_encode'
          5        INIT_ARRAY                                       ~3      !0
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
   21    10      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FuSSZ6%3A17%241

Class Dummy:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uSSZ6
function name:  jsonSerialize
number of ops:  6
compiled vars:  !0 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_GLOBAL                                              !0, 'flag'
    6     1      > JMPZ                                                     !0, ->4
    7     2    > > EXIT                                                     
          3*       JMP                                                      ->5
    9     4    > > RETURN                                                   'xxxx'
   11     5*     > RETURN                                                   null

End of function jsonserialize

End of class Dummy.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.97 ms | 1400 KiB | 19 Q