3v4l.org

run code in 500+ PHP versions simultaneously
<?php $x = 4; if($x == 1){ class X{} session_start(); $_SESSION["x"] = new X(); $_SESSION["y"] = "5"; echo session_encode(); // x|O:1:"X":0:{}y|s:1:"5"; } elseif($x == 2){ session_start(); session_decode('x|O:1:"X":0:{}y|s:1:"5";'); $_SESSION["y"] = 6; echo session_encode(); die(); print_r($_SESSION); /* Array ( [x] => __PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => X ) [y] => 5 ) */ } elseif($x == 3){ enum Y{ case Y; } session_start(); $_SESSION["x"] = Y::Y; $_SESSION["y"] = "5"; echo session_encode(); // x|E:3:"Y:Y";y|s:1:"5"; } elseif($x == 4){ session_start(); session_decode('x|E:3:"Y:Y";y|s:1:"5";'); print_r($_SESSION); /* Warning: session_decode(): Class 'Y' not found in /in/1IEIF on line 36 Warning: session_decode(): Failed to decode session object. Session has been destroyed in /in/1IEIF on line 36 Array ( ) */ }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 38
Branch analysis from position: 20
1 jumps found. (Code = 61) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 54
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 65
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 65
filename:       /in/mLGPa
function name:  (null)
number of ops:  66
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, ->18
    4     3    >   DECLARE_CLASS                                                'x'
    5     4        INIT_FCALL                                                   'session_start'
          5        DO_ICALL                                                     
    6     6        NEW                                                  $6      'X'
          7        DO_FCALL                                          0          
          8        FETCH_W                          global              $4      '_SESSION'
          9        ASSIGN_DIM                                                   $4, 'x'
         10        OP_DATA                                                      $6
    7    11        FETCH_W                          global              $8      '_SESSION'
         12        ASSIGN_DIM                                                   $8, 'y'
         13        OP_DATA                                                      '5'
    8    14        INIT_FCALL                                                   'session_encode'
         15        DO_ICALL                                             $10     
         16        ECHO                                                         $10
    3    17      > JMP                                                          ->65
   10    18    >   IS_EQUAL                                                     !0, 2
         19      > JMPZ                                                         ~11, ->38
   11    20    >   INIT_FCALL                                                   'session_start'
         21        DO_ICALL                                                     
   12    22        INIT_FCALL                                                   'session_decode'
         23        SEND_VAL                                                     'x%7CO%3A1%3A%22X%22%3A0%3A%7B%7Dy%7Cs%3A1%3A%225%22%3B'
         24        DO_ICALL                                                     
   13    25        FETCH_W                          global              $14     '_SESSION'
         26        ASSIGN_DIM                                                   $14, 'y'
         27        OP_DATA                                                      6
   14    28        INIT_FCALL                                                   'session_encode'
         29        DO_ICALL                                             $16     
         30        ECHO                                                         $16
   15    31      > INIT_FCALL                                                   'exit'
         32*       DO_ICALL                                                     
   16    33*       INIT_FCALL                                                   'print_r'
         34*       FETCH_R                          global              ~18     '_SESSION'
         35*       SEND_VAL                                                     ~18
         36*       DO_ICALL                                                     
   10    37*       JMP                                                          ->65
   28    38    >   IS_EQUAL                                                     !0, 3
         39      > JMPZ                                                         ~20, ->54
   29    40    >   DECLARE_CLASS                                                'y'
   32    41        INIT_FCALL                                                   'session_start'
         42        DO_ICALL                                                     
   33    43        FETCH_CLASS_CONSTANT                                 ~24     'Y', 'Y'
         44        FETCH_W                          global              $22     '_SESSION'
         45        ASSIGN_DIM                                                   $22, 'x'
         46        OP_DATA                                                      ~24
   34    47        FETCH_W                          global              $25     '_SESSION'
         48        ASSIGN_DIM                                                   $25, 'y'
         49        OP_DATA                                                      '5'
   35    50        INIT_FCALL                                                   'session_encode'
         51        DO_ICALL                                             $27     
         52        ECHO                                                         $27
   28    53      > JMP                                                          ->65
   37    54    >   IS_EQUAL                                                     !0, 4
         55      > JMPZ                                                         ~28, ->65
   38    56    >   INIT_FCALL                                                   'session_start'
         57        DO_ICALL                                                     
   39    58        INIT_FCALL                                                   'session_decode'
         59        SEND_VAL                                                     'x%7CE%3A3%3A%22Y%3AY%22%3By%7Cs%3A1%3A%225%22%3B'
         60        DO_ICALL                                                     
   40    61        INIT_FCALL                                                   'print_r'
         62        FETCH_R                          global              ~31     '_SESSION'
         63        SEND_VAL                                                     ~31
         64        DO_ICALL                                                     
   49    65    > > RETURN                                                       1

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

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.65 ms | 912 KiB | 13 Q