3v4l.org

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

Function %00%7Bclosure%7D%2Fin%2FBaj7g%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Baj7g
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%2FBaj7g%3A12%240

Class TestClosure:
Function testclosures:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Baj7g
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%2FBaj7g%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 TestClosure.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.51 ms | 1395 KiB | 13 Q