3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Kitchen { private $yummy = 'cake'; public function change_treat() { $this->yummy = 'pie'; } } class pantry extends Kitchen { public function FindFood() { $yum = function () { return $this->yummy; }; $kit = new Kitchen(); $yumers = Closure::bind($yum, $kit, $kit); echo "Look, a " . $yumers(). "!\n"; } } $p = new pantry(); $p->FindFood(); $p->change_treat(); $p->FindFood();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b81Dg
function name:  (null)
number of ops:  10
compiled vars:  !0 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $1      'pantry'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   32     3        INIT_METHOD_CALL                                         !0, 'FindFood'
          4        DO_FCALL                                      0          
   33     5        INIT_METHOD_CALL                                         !0, 'change_treat'
          6        DO_FCALL                                      0          
   34     7        INIT_METHOD_CALL                                         !0, 'FindFood'
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fb81Dg%3A20%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b81Dg
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   FETCH_THIS                                       $0      
          1        FETCH_OBJ_R                                      ~1      $0, 'yummy'
          2      > RETURN                                                   ~1
   23     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fb81Dg%3A20%240

Class Kitchen:
Function change_treat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b81Dg
function name:  change_treat
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                               'yummy'
          1        OP_DATA                                                  'pie'
   10     2      > RETURN                                                   null

End of function change_treat

End of class Kitchen.

Class pantry:
Function findfood:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b81Dg
function name:  FindFood
number of ops:  17
compiled vars:  !0 = $yum, !1 = $kit, !2 = $yumers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fb81Dg%3A20%240'
          1        ASSIGN                                                   !0, ~3
   25     2        NEW                                              $5      'Kitchen'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   26     5        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !2, $8
   27    11        INIT_DYNAMIC_CALL                                        !2
         12        DO_FCALL                                      0  $10     
         13        CONCAT                                           ~11     'Look%2C+a+', $10
         14        CONCAT                                           ~12     ~11, '%21%0A'
         15        ECHO                                                     ~12
   28    16      > RETURN                                                   null

End of function findfood

Function change_treat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b81Dg
function name:  change_treat
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                               'yummy'
          1        OP_DATA                                                  'pie'
   10     2      > RETURN                                                   null

End of function change_treat

End of class pantry.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.17 ms | 1390 KiB | 13 Q