3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Action { public $callback = null; public function __construct(callable $callback) { $this->callback = $callback; } public function __call($method, $args) { if ($method === 'callback') { return call_user_func_array($this->callback, $args); } } } $action = new Action(function($value) { // do something with $value; return $value; }); echo $action->callback('abc');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oBR0L
function name:  (null)
number of ops:  10
compiled vars:  !0 = $action
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'Action'
          1        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   23     2        SEND_VAL_EX                                              ~2
   19     3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   25     5        INIT_METHOD_CALL                                         !0, 'callback'
          6        SEND_VAL_EX                                              'abc'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
          9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oBR0L
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   22     1      > RETURN                                                   !0
   23     2*     > RETURN                                                   null

End of Dynamic Function 0

Class Action:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oBR0L
function name:  __construct
number of ops:  4
compiled vars:  !0 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'callback'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function __construct

Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oBR0L
function name:  __call
number of ops:  11
compiled vars:  !0 = $method, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        IS_IDENTICAL                                             !0, 'callback'
          3      > JMPZ                                                     ~2, ->10
   14     4    >   FETCH_OBJ_R                                      ~3      'callback'
          5        INIT_USER_CALL                                0          'call_user_func_array', ~3
          6        SEND_ARRAY                                               !1
          7        CHECK_UNDEF_ARGS                                         
          8        DO_FCALL                                      1  $4      
          9      > RETURN                                                   $4
   16    10    > > RETURN                                                   null

End of function __call

End of class Action.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.82 ms | 1000 KiB | 13 Q