3v4l.org

run code in 300+ PHP versions simultaneously
<?php class BaconClass { private $array = []; public function AddBacon(callable $function) { $this->array[] = $function; } public function GetBacon() { foreach ($this->array as $function) { echo $function(); } } } $bacon = new BaconClass(); $bacon->AddBacon(function() { echo "Om nom nom"; }); $bacon->AddBacon(function() { echo "I like bacon"; }); $bacon->GetBacon();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BI1c2
function name:  (null)
number of ops:  14
compiled vars:  !0 = $bacon
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'BaconClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   21     3        INIT_METHOD_CALL                                         !0, 'AddBacon'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBI1c2%3A21%240'
          5        SEND_VAL_EX                                              ~4
          6        DO_FCALL                                      0          
   22     7        INIT_METHOD_CALL                                         !0, 'AddBacon'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBI1c2%3A22%241'
          9        SEND_VAL_EX                                              ~6
         10        DO_FCALL                                      0          
   23    11        INIT_METHOD_CALL                                         !0, 'GetBacon'
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FBI1c2%3A21%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BI1c2
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ECHO                                                     'Om+nom+nom'
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FBI1c2%3A21%240

Function %00%7Bclosure%7D%2Fin%2FBI1c2%3A22%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BI1c2
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ECHO                                                     'I+like+bacon'
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FBI1c2%3A22%241

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

End of function addbacon

Function getbacon:
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/BI1c2
function name:  GetBacon
number of ops:  9
compiled vars:  !0 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_OBJ_R                                      ~1      'array'
          1      > FE_RESET_R                                       $2      ~1, ->7
          2    > > FE_FETCH_R                                               $2, !0, ->7
   13     3    >   INIT_DYNAMIC_CALL                                        !0
          4        DO_FCALL                                      0  $3      
          5        ECHO                                                     $3
   12     6      > JMP                                                      ->2
          7    >   FE_FREE                                                  $2
   15     8      > RETURN                                                   null

End of function getbacon

End of class BaconClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.14 ms | 1390 KiB | 13 Q