3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Storage { private $things = array(); public function add($item) { $this->things[] = $item; } public function evaluate(Storage $container) { return $container->things; } } class A extends Storage {} $bucket = new Storage(); $bucket->add("phone"); $bucket->add("biscuits"); $bucket->add("handcream"); $basket = new A(); print_r($basket->evaluate($bucket));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5omYo
function name:  (null)
number of ops:  22
compiled vars:  !0 = $bucket, !1 = $basket
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'Storage'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   19     3        INIT_METHOD_CALL                                         !0, 'add'
          4        SEND_VAL_EX                                              'phone'
          5        DO_FCALL                                      0          
   20     6        INIT_METHOD_CALL                                         !0, 'add'
          7        SEND_VAL_EX                                              'biscuits'
          8        DO_FCALL                                      0          
   21     9        INIT_METHOD_CALL                                         !0, 'add'
         10        SEND_VAL_EX                                              'handcream'
         11        DO_FCALL                                      0          
   23    12        NEW                                              $8      'A'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $8
   24    15        INIT_FCALL                                               'print_r'
         16        INIT_METHOD_CALL                                         !1, 'evaluate'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $11     
         19        SEND_VAR                                                 $11
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Class Storage:
Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5omYo
function name:  add
number of ops:  5
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        FETCH_OBJ_W                                      $1      'things'
          2        ASSIGN_DIM                                               $1
          3        OP_DATA                                                  !0
    9     4      > RETURN                                                   null

End of function add

Function evaluate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5omYo
function name:  evaluate
number of ops:  4
compiled vars:  !0 = $container
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        FETCH_OBJ_R                                      ~1      !0, 'things'
          2      > RETURN                                                   ~1
   13     3*     > RETURN                                                   null

End of function evaluate

End of class Storage.

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

End of function add

Function evaluate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5omYo
function name:  evaluate
number of ops:  4
compiled vars:  !0 = $container
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        FETCH_OBJ_R                                      ~1      !0, 'things'
          2      > RETURN                                                   ~1
   13     3*     > RETURN                                                   null

End of function evaluate

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.18 ms | 1400 KiB | 15 Q