3v4l.org

run code in 300+ PHP versions simultaneously
<?php class BaconClass { private $array; public function __construct() { $this->array = array(); } public function AddBacon($function) { array_push($this->array, $function); } /* ... */ public function GetBacon() { foreach($this->array as $function) { echo $function(); } } } $bacon = new BaconClass(); $bacon->AddBacon(function() { echo "Om nom nom"; }); /* And somewhere else I might have */ $bacon->AddBacon(function() { echo "I like bacon"; }); /* And then after all of this I have */ $bacon->GetBacon();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7mKAF
function name:  (null)
number of ops:  14
compiled vars:  !0 = $bacon
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'BaconClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        INIT_METHOD_CALL                                         !0, 'AddBacon'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F7mKAF%3A25%240'
   27     5        SEND_VAL_EX                                              ~4
          6        DO_FCALL                                      0          
   31     7        INIT_METHOD_CALL                                         !0, 'AddBacon'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F7mKAF%3A31%241'
   33     9        SEND_VAL_EX                                              ~6
         10        DO_FCALL                                      0          
   36    11        INIT_METHOD_CALL                                         !0, 'GetBacon'
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2F7mKAF%3A25%240

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

End of function %00%7Bclosure%7D%2Fin%2F7mKAF%3A31%241

Class BaconClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7mKAF
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN_OBJ                                               'array'
          1        OP_DATA                                                  <array>
    8     2      > RETURN                                                   null

End of function __construct

Function addbacon:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7mKAF
function name:  AddBacon
number of ops:  7
compiled vars:  !0 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'array_push'
          2        FETCH_OBJ_W                                      $1      'array'
          3        SEND_REF                                                 $1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   12     6      > 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/7mKAF
function name:  GetBacon
number of ops:  9
compiled vars:  !0 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~1      'array'
          1      > FE_RESET_R                                       $2      ~1, ->7
          2    > > FE_FETCH_R                                               $2, !0, ->7
   18     3    >   INIT_DYNAMIC_CALL                                        !0
          4        DO_FCALL                                      0  $3      
          5        ECHO                                                     $3
   17     6      > JMP                                                      ->2
          7    >   FE_FREE                                                  $2
   20     8      > RETURN                                                   null

End of function getbacon

End of class BaconClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.58 ms | 1400 KiB | 15 Q