3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj = new StdClass; $obj->fn = function($arg) { return "Hello $arg"; }; echo ($obj->fn)('World'); class Bla { public $fn; } $bla = new Bla; $bla->fn = function($arg="Bu"){return "Hello lo $arg"; }; // can't do in class! echo ($bla->fn)('Wa');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jZbnH
function name:  (null)
number of ops:  23
compiled vars:  !0 = $obj, !1 = $bla
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $2      'StdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    4     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FjZbnH%3A4%240'
          4        ASSIGN_OBJ                                               !0, 'fn'
          5        OP_DATA                                                  ~6
    5     6        FETCH_OBJ_R                                      ~7      !0, 'fn'
          7        INIT_DYNAMIC_CALL                                        ~7
          8        SEND_VAL_EX                                              'World'
          9        DO_FCALL                                      0  $8      
         10        ECHO                                                     $8
   10    11        NEW                                              $9      'Bla'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !1, $9
   11    14        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FjZbnH%3A11%241'
         15        ASSIGN_OBJ                                               !1, 'fn'
         16        OP_DATA                                                  ~13
   12    17        FETCH_OBJ_R                                      ~14     !1, 'fn'
         18        INIT_DYNAMIC_CALL                                        ~14
         19        SEND_VAL_EX                                              'Wa'
         20        DO_FCALL                                      0  $15     
         21        ECHO                                                     $15
         22      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FjZbnH%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jZbnH
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        NOP                                                      
          2        FAST_CONCAT                                      ~1      'Hello+', !0
          3      > RETURN                                                   ~1
          4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FjZbnH%3A4%240

Function %00%7Bclosure%7D%2Fin%2FjZbnH%3A11%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jZbnH
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV_INIT                                        !0      'Bu'
          1        NOP                                                      
          2        FAST_CONCAT                                      ~1      'Hello+lo+', !0
          3      > RETURN                                                   ~1
          4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FjZbnH%3A11%241

Class Bla: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.72 ms | 1399 KiB | 13 Q