3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { private $data = array("Foo"); public function __sleep() { return array("data"); } } class Bar implements Serializable{ private $data = array("Bar"); public function serialize() { return serialize($this->data); } public function unserialize($data) { $this->data = unserialize($data); } public function __sleep() { echo "this won't get called"; exit; } } $foo = new Foo; $bar = new Bar; var_dump(serialize($foo)); var_dump(serialize($bar));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B57Kk
function name:  (null)
number of ops:  20
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   DECLARE_CLASS                                                'bar'
   26     1        NEW                                                  $2      'Foo'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
   27     4        NEW                                                  $5      'Bar'
          5        DO_FCALL                                          0          
          6        ASSIGN                                                       !1, $5
   28     7        INIT_FCALL                                                   'var_dump'
          8        INIT_FCALL                                                   'serialize'
          9        SEND_VAR                                                     !0
         10        DO_ICALL                                             $8      
         11        SEND_VAR                                                     $8
         12        DO_ICALL                                                     
   29    13        INIT_FCALL                                                   'var_dump'
         14        INIT_FCALL                                                   'serialize'
         15        SEND_VAR                                                     !1
         16        DO_ICALL                                             $10     
         17        SEND_VAR                                                     $10
         18        DO_ICALL                                                     
         19      > RETURN                                                       1

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

End of function __sleep

End of class Foo.

Class Bar:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B57Kk
function name:  serialize
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'data'
          2        SEND_VAL                                                     ~0
          3        DO_ICALL                                             $1      
          4      > RETURN                                                       $1
   14     5*     > RETURN                                                       null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B57Kk
function name:  unserialize
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
   17     1        INIT_FCALL                                                   'unserialize'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $2      
          4        ASSIGN_OBJ                                                   'data'
          5        OP_DATA                                                      $2
   18     6      > RETURN                                                       null

End of function unserialize

Function __sleep:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 61) Position 1 = -2
filename:       /in/B57Kk
function name:  __sleep
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   ECHO                                                         'this+won%27t+get+called'
   22     1      > INIT_FCALL                                                   'exit'
          2*       DO_ICALL                                                     
   23     3*     > RETURN                                                       null

End of function __sleep

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
179.92 ms | 3403 KiB | 17 Q