3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function op($op, $f) { return $op($this->$f); } } $a = new Foo(); $a->f = [1, 17, 23, 9, 12, 3, 9, 2, 7, 68]; 'avg'; var_dump($a->op(function($x) { return array_sum($x) / count($x); }, 'f'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a2vTO
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   11     3        ASSIGN_OBJ                                               !0, 'f'
          4        OP_DATA                                                  <array>
   12     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'op'
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fa2vTO%3A12%240'
          8        SEND_VAL_EX                                              ~5
          9        SEND_VAL_EX                                              'f'
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fa2vTO%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a2vTO
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'array_sum'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        COUNT                                            ~2      !0
          5        DIV                                              ~3      $1, ~2
          6      > RETURN                                                   ~3
          7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fa2vTO%3A12%240

Class Foo:
Function op:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a2vTO
function name:  op
number of ops:  9
compiled vars:  !0 = $op, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_DYNAMIC_CALL                                        !0
          3        CHECK_FUNC_ARG                                           
          4        FETCH_OBJ_FUNC_ARG                               $2      !1
          5        SEND_FUNC_ARG                                            $2
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
    6     8*     > RETURN                                                   null

End of function op

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.89 ms | 1396 KiB | 17 Q