3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public $a; public function __construct(int $value) { $this->a = $value; } } class B { public $ar = array(); public function addValue(A $value) { $this->ar[] = $value; } public function print(){ var_dump($this->ar); } public function selectValue() { foreach($this->ar as &$value){ $value->a += 10; } } public function __clone(){ $this->ar = clone $this->ar; } } $one = new A(10); $two = new A(15); $b = new B; $b->addValue($one); $b->addValue($two); $b->print(); $c = new B; $c = $b->cl(); //$c = clone $b; $b->selectValue(); $c->print();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dUWWD
function name:  (null)
number of ops:  30
compiled vars:  !0 = $one, !1 = $two, !2 = $b, !3 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   38     0  E >   NEW                                                  $4      'A'
          1        SEND_VAL_EX                                                  10
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $4
   39     4        NEW                                                  $7      'A'
          5        SEND_VAL_EX                                                  15
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $7
   41     8        NEW                                                  $10     'B'
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !2, $10
   43    11        INIT_METHOD_CALL                                             !2, 'addValue'
         12        SEND_VAR_EX                                                  !0
         13        DO_FCALL                                          0          
   44    14        INIT_METHOD_CALL                                             !2, 'addValue'
         15        SEND_VAR_EX                                                  !1
         16        DO_FCALL                                          0          
   46    17        INIT_METHOD_CALL                                             !2, 'print'
         18        DO_FCALL                                          0          
   48    19        NEW                                                  $16     'B'
         20        DO_FCALL                                          0          
         21        ASSIGN                                                       !3, $16
   49    22        INIT_METHOD_CALL                                             !2, 'cl'
         23        DO_FCALL                                          0  $19     
         24        ASSIGN                                                       !3, $19
   52    25        INIT_METHOD_CALL                                             !2, 'selectValue'
         26        DO_FCALL                                          0          
   54    27        INIT_METHOD_CALL                                             !3, 'print'
         28        DO_FCALL                                          0          
         29      > RETURN                                                       1

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

End of function __construct

End of class A.

Class B:
Function addvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dUWWD
function name:  addValue
number of ops:  5
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   19     1        FETCH_OBJ_W                                          $1      'ar'
          2        ASSIGN_DIM                                                   $1
          3        OP_DATA                                                      !0
   20     4      > RETURN                                                       null

End of function addvalue

Function print:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dUWWD
function name:  print
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                                   'var_dump'
          1        FETCH_OBJ_R                                          ~0      'ar'
          2        SEND_VAL                                                     ~0
          3        DO_ICALL                                                     
   24     4      > RETURN                                                       null

End of function print

Function selectvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/dUWWD
function name:  selectValue
number of ops:  8
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   FETCH_OBJ_W                                          $1      'ar'
          1      > FE_RESET_RW                                          $2      $1, ->6
          2    > > FE_FETCH_RW                                                  $2, !0, ->6
   29     3    >   ASSIGN_OBJ_OP                                     1          !0, 'a'
          4        OP_DATA                                                      10
   28     5      > JMP                                                          ->2
          6    >   FE_FREE                                                      $2
   31     7      > RETURN                                                       null

End of function selectvalue

Function __clone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dUWWD
function name:  __clone
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   34     0  E >   FETCH_OBJ_R                                          ~1      'ar'
          1        CLONE                                                ~2      ~1
          2        ASSIGN_OBJ                                                   'ar'
          3        OP_DATA                                                      ~2
   35     4      > RETURN                                                       null

End of function __clone

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.45 ms | 2476 KiB | 14 Q