3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Obj { public function __construct($mix) { foreach ($mix as $k => $v) { $this->$k = $v; } } public function __toString() { $str = ''; foreach ($this as $k => $v) { $str = "$k => $v\n"; } return $str; } } class A { public $obj; public function setObj($obj) { $this->obj = $obj; } public function getObj() { return $this->obj; } function __sleep() { return ['test' => $this->obj]; } } function printA(A $a) { var_dump($a); serialize(debug_backtrace(0)); } $obj = new Obj(['hello'=>'there']); $a = new A(); $a->setObj($obj); var_dump($a->getObj()); printA($a); var_dump($a->getObj());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hN9eJ
function name:  (null)
number of ops:  25
compiled vars:  !0 = $obj, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'obj'
   42     1        NEW                                              $2      'Obj'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   43     5        NEW                                              $5      'A'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   44     8        INIT_METHOD_CALL                                         !1, 'setObj'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
   46    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !1, 'getObj'
         13        DO_FCALL                                      0  $9      
         14        SEND_VAR                                                 $9
         15        DO_ICALL                                                 
   48    16        INIT_FCALL                                               'printa'
         17        SEND_VAR                                                 !1
         18        DO_FCALL                                      0          
   50    19        INIT_FCALL                                               'var_dump'
         20        INIT_METHOD_CALL                                         !1, 'getObj'
         21        DO_FCALL                                      0  $12     
         22        SEND_VAR                                                 $12
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Function printa:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hN9eJ
function name:  printA
number of ops:  11
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
   37     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   39     4        INIT_FCALL                                               'serialize'
          5        INIT_FCALL                                               'debug_backtrace'
          6        SEND_VAL                                                 0
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
   40    10      > RETURN                                                   null

End of function printa

Class Obj:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/hN9eJ
function name:  __construct
number of ops:  9
compiled vars:  !0 = $mix, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1      > FE_RESET_R                                       $3      !0, ->7
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->7
          3    >   ASSIGN                                                   !2, ~4
    6     4        ASSIGN_OBJ                                               !2
          5        OP_DATA                                                  !1
    5     6      > JMP                                                      ->2
          7    >   FE_FREE                                                  $3
    8     8      > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/hN9eJ
function name:  __toString
number of ops:  16
compiled vars:  !0 = $str, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, ''
   12     1        FETCH_THIS                                       ~4      
          2      > FE_RESET_R                                       $5      ~4, ->11
          3    > > FE_FETCH_R                                       ~6      $5, !1, ->11
          4    >   ASSIGN                                                   !2, ~6
   13     5        ROPE_INIT                                     4  ~9      !2
          6        ROPE_ADD                                      1  ~9      ~9, '+%3D%3E+'
          7        ROPE_ADD                                      2  ~9      ~9, !1
          8        ROPE_END                                      3  ~8      ~9, '%0A'
          9        ASSIGN                                                   !0, ~8
   12    10      > JMP                                                      ->3
         11    >   FE_FREE                                                  $5
   16    12        VERIFY_RETURN_TYPE                                       !0
         13      > RETURN                                                   !0
   17    14*       VERIFY_RETURN_TYPE                                       
         15*     > RETURN                                                   null

End of function __tostring

End of class Obj.

Class A:
Function setobj:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hN9eJ
function name:  setObj
number of ops:  4
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1        ASSIGN_OBJ                                               'obj'
          2        OP_DATA                                                  !0
   25     3      > RETURN                                                   null

End of function setobj

Function getobj:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hN9eJ
function name:  getObj
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   FETCH_OBJ_R                                      ~0      'obj'
          1      > RETURN                                                   ~0
   29     2*     > RETURN                                                   null

End of function getobj

Function __sleep:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hN9eJ
function name:  __sleep
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   FETCH_OBJ_R                                      ~0      'obj'
          1        INIT_ARRAY                                       ~1      ~0, 'test'
          2      > RETURN                                                   ~1
   33     3*     > RETURN                                                   null

End of function __sleep

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.67 ms | 1011 KiB | 17 Q