3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ClosureTest { private $a = 'a'; private $b = 'b'; public function testClosures() { $testClosure = function($var) { echo $var . ' ' . $this->a . ' ' . $this->b; }; $testClosure('hello!'); } } $closureTest = new ClosureTest(); var_dump($closureTest); $closureTest->testClosures();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/16Q8o
function name:  (null)
number of ops:  9
compiled vars:  !0 = $closureTest
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'ClosureTest'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   27     6        INIT_METHOD_CALL                                         !0, 'testClosures'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F16Q8o%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/16Q8o
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        CONCAT                                           ~1      !0, '+'
          2        FETCH_THIS                                       $2      
          3        FETCH_OBJ_R                                      ~3      $2, 'a'
          4        CONCAT                                           ~4      ~1, ~3
          5        CONCAT                                           ~5      ~4, '+'
          6        FETCH_THIS                                       $6      
          7        FETCH_OBJ_R                                      ~7      $6, 'b'
          8        CONCAT                                           ~8      ~5, ~7
          9        ECHO                                                     ~8
   15    10      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F16Q8o%3A12%240

Class ClosureTest:
Function testclosures:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/16Q8o
function name:  testClosures
number of ops:  6
compiled vars:  !0 = $testClosure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F16Q8o%3A12%240'
          1        ASSIGN                                                   !0, ~1
   17     2        INIT_DYNAMIC_CALL                                        !0
          3        SEND_VAL_EX                                              'hello%21'
          4        DO_FCALL                                      0          
   19     5      > RETURN                                                   null

End of function testclosures

End of class ClosureTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.52 ms | 1396 KiB | 15 Q