3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = 4; if($x == 1){ class X{} $x = []; $x["x"] = new X(); $x["y"] = "5"; echo serialize($x); // a:2:{s:1:"x";O:1:"X":0:{}s:1:"y";s:1:"5";} } elseif($x == 2){ $x = unserialize('a:2:{s:1:"x";O:1:"X":0:{}s:1:"y";s:1:"5";}'); print_r($x); /* Array ( [x] => __PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => X ) [y] => 5 ) */ } elseif($x == 3){ enum Y{ case Y; } $x = []; $x["x"] = Y::Y; $x["y"] = "5"; echo serialize($x); // a:2:{s:1:"x";E:3:"Y:Y";s:1:"y";s:1:"5";} } elseif($x == 4){ $x = unserialize('a:2:{s:1:"x";E:3:"Y:Y";s:1:"y";s:1:"5";}'); print_r($x); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 26
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 40
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 49
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
filename:       /in/u130I
function name:  (null)
number of ops:  50
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 4
    3     1        IS_EQUAL                                                 !0, 1
          2      > JMPZ                                                     ~2, ->16
    4     3    >   DECLARE_CLASS                                            'x'
    5     4        ASSIGN                                                   !0, <array>
    6     5        NEW                                              $5      'X'
          6        DO_FCALL                                      0          
          7        ASSIGN_DIM                                               !0, 'x'
          8        OP_DATA                                                  $5
    7     9        ASSIGN_DIM                                               !0, 'y'
         10        OP_DATA                                                  '5'
    8    11        INIT_FCALL                                               'serialize'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $8      
         14        ECHO                                                     $8
    3    15      > JMP                                                      ->49
   10    16    >   IS_EQUAL                                                 !0, 2
         17      > JMPZ                                                     ~9, ->26
   11    18    >   INIT_FCALL                                               'unserialize'
         19        SEND_VAL                                                 'a%3A2%3A%7Bs%3A1%3A%22x%22%3BO%3A1%3A%22X%22%3A0%3A%7B%7Ds%3A1%3A%22y%22%3Bs%3A1%3A%225%22%3B%7D'
         20        DO_ICALL                                         $10     
         21        ASSIGN                                                   !0, $10
   12    22        INIT_FCALL                                               'print_r'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
   10    25      > JMP                                                      ->49
   24    26    >   IS_EQUAL                                                 !0, 3
         27      > JMPZ                                                     ~13, ->40
   25    28    >   DECLARE_CLASS                                            'y'
   28    29        ASSIGN                                                   !0, <array>
   29    30        FETCH_CLASS_CONSTANT                             ~16     'Y', 'Y'
         31        ASSIGN_DIM                                               !0, 'x'
         32        OP_DATA                                                  ~16
   30    33        ASSIGN_DIM                                               !0, 'y'
         34        OP_DATA                                                  '5'
   31    35        INIT_FCALL                                               'serialize'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $18     
         38        ECHO                                                     $18
   24    39      > JMP                                                      ->49
   33    40    >   IS_EQUAL                                                 !0, 4
         41      > JMPZ                                                     ~19, ->49
   34    42    >   INIT_FCALL                                               'unserialize'
         43        SEND_VAL                                                 'a%3A2%3A%7Bs%3A1%3A%22x%22%3BE%3A3%3A%22Y%3AY%22%3Bs%3A1%3A%22y%22%3Bs%3A1%3A%225%22%3B%7D'
         44        DO_ICALL                                         $20     
         45        ASSIGN                                                   !0, $20
   35    46        INIT_FCALL                                               'print_r'
         47        SEND_VAR                                                 !0
         48        DO_ICALL                                                 
   36    49    > > RETURN                                                   1

Class X: [no user functions]
Class Y: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.66 ms | 1009 KiB | 16 Q