3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public $throw_exception = false; function __sleep() { return array('throw_exception' => true); } function __construct() { echo "construct called\n"; if ($this->throw_exception == true) { throw new Exception(); } } } $a = new foo; $x = serialize($a); $y = unserialize($x);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HTOEc
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a, !1 = $x, !2 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $3      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   17     3        INIT_FCALL                                               'serialize'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !1, $6
   18     7        INIT_FCALL                                               'unserialize'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $8      
         10        ASSIGN                                                   !2, $8
         11      > RETURN                                                   1

Class foo:
Function __sleep:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HTOEc
function name:  __sleep
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   <array>
          1*     > RETURN                                                   null

End of function __sleep

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/HTOEc
function name:  __construct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'construct+called%0A'
    9     1        FETCH_OBJ_R                                      ~0      'throw_exception'
          2        BOOL                                             ~1      ~0
          3      > JMPZ                                                     ~1, ->7
   11     4    >   NEW                                              $2      'Exception'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $2
   13     7    > > RETURN                                                   null

End of function __construct

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.68 ms | 1396 KiB | 17 Q