3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); $f=function($var){ echo "the closure test $var\n"; }; class Bla { public $foo; public function __construct($f){ $this->foo = $f; } } $bla = new Bla($f); ($bla->foo)("someval");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PoatM
function name:  (null)
number of ops:  14
compiled vars:  !0 = $f, !1 = $bla
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    4     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPoatM%3A4%240'
          4        ASSIGN                                                   !0, ~3
   16     5        NEW                                              $5      'Bla'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $5
   17     9        FETCH_OBJ_R                                      ~8      !1, 'foo'
         10        INIT_DYNAMIC_CALL                                        ~8
         11        SEND_VAL_EX                                              'someval'
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FPoatM%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PoatM
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ROPE_INIT                                     3  ~2      'the+closure+test+'
          2        ROPE_ADD                                      1  ~2      ~2, !0
          3        ROPE_END                                      2  ~1      ~2, '%0A'
          4        ECHO                                                     ~1
    7     5      > RETURN                                                   null

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

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

End of function __construct

End of class Bla.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.78 ms | 1388 KiB | 15 Q