3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $is_call = false; public function getFunc() { } public function run() { $is_enable = true; $func = function($str) use ($is_enable) { if ($is_enable) { echo $str; } }; $func('ok'); echo PHP_EOL.'---------------'.PHP_EOL; $is_enable = false; $func('not ok'); $is_enable = true; $func('--ok--'); } } $test = new Test(); $test->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CAeTj
function name:  (null)
number of ops:  6
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   33     3        INIT_METHOD_CALL                                         !0, 'run'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FCAeTj%3A15%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
filename:       /in/CAeTj
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $str, !1 = $is_enable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   16     2      > JMPZ                                                     !1, ->4
   17     3    >   ECHO                                                     !0
   19     4    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FCAeTj%3A15%240

Class Test:
Function getfunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CAeTj
function name:  getFunc
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E > > RETURN                                                   null

End of function getfunc

Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CAeTj
function name:  run
number of ops:  17
compiled vars:  !0 = $is_enable, !1 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <true>
   15     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FCAeTj%3A15%240'
          2        BIND_LEXICAL                                             ~3, !0
          3        ASSIGN                                                   !1, ~3
   20     4        INIT_DYNAMIC_CALL                                        !1
          5        SEND_VAL_EX                                              'ok'
          6        DO_FCALL                                      0          
   22     7        ECHO                                                     '%0A---------------%0A'
   24     8        ASSIGN                                                   !0, <false>
   25     9        INIT_DYNAMIC_CALL                                        !1
         10        SEND_VAL_EX                                              'not+ok'
         11        DO_FCALL                                      0          
   27    12        ASSIGN                                                   !0, <true>
   28    13        INIT_DYNAMIC_CALL                                        !1
         14        SEND_VAL_EX                                              '--ok--'
         15        DO_FCALL                                      0          
   29    16      > RETURN                                                   null

End of function run

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.8 ms | 1399 KiB | 13 Q