3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tap($value, $callback) { $callback($value); return $value; } class Test { public $val = 0; public function increment($val) { $this->val += $val; } } $a = new Test(); var_dump( tap($a, function($value) { return $value->increment(5);}) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gfQt0
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'tap'
          5        SEND_VAR                                                 !0
          6        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          7        SEND_VAL                                                 ~4
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                                 
         11      > 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/gfQt0
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV                                             !0      
          1        INIT_METHOD_CALL                                         !0, 'increment'
          2        SEND_VAL_EX                                              5
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of Dynamic Function 0

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

End of function tap

Class Test:
Function increment:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gfQt0
function name:  increment
number of ops:  4
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        ASSIGN_OBJ_OP                                 1          'val'
          2        OP_DATA                                                  !0
   15     3      > RETURN                                                   null

End of function increment

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.54 ms | 1008 KiB | 15 Q