3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); class A{ protected $stuff; function __construct($foo){ if(!is_float($foo)) throw new TypeError; $this->stuff = $foo; } static function __set_state($data){ return new A($data['stuff']); } } $x = new A(0.0); eval('$y = ' . var_export($x, true) . ';');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TMaAJ
function name:  (null)
number of ops:  12
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'A'
          1        SEND_VAL_EX                                              0
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   16     4        INIT_FCALL                                               'var_export'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $4      
          8        CONCAT                                           ~5      '%24y+%3D+', $4
          9        CONCAT                                           ~6      ~5, '%3B'
         10        INCLUDE_OR_EVAL                                          ~6, EVAL
         11      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TMaAJ
function name:  __construct
number of ops:  10
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        TYPE_CHECK                                   32  ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->7
    7     4    >   NEW                                              $3      'TypeError'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $3
    8     7    >   ASSIGN_OBJ                                               'stuff'
          8        OP_DATA                                                  !0
    9     9      > RETURN                                                   null

End of function __construct

Function __set_state:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TMaAJ
function name:  __set_state
number of ops:  8
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        NEW                                              $1      'A'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_DIM_FUNC_ARG                               $2      !0, 'stuff'
          4        SEND_FUNC_ARG                                            $2
          5        DO_FCALL                                      0          
          6      > RETURN                                                   $1
   12     7*     > RETURN                                                   null

End of function __set_state

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.6 ms | 1396 KiB | 15 Q