3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestClosure { private $a = 'a'; private $b = 'b'; public function testClosures() { $testClosure = function($var) use ($a, $b) { 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/Pt1aY
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%2FPt1aY%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pt1aY
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $var, !1 = $a, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   13     3        CONCAT                                           ~3      !0, '+'
          4        FETCH_THIS                                       $4      
          5        FETCH_OBJ_R                                      ~5      $4, 'a'
          6        CONCAT                                           ~6      ~3, ~5
          7        CONCAT                                           ~7      ~6, '+'
          8        FETCH_THIS                                       $8      
          9        FETCH_OBJ_R                                      ~9      $8, 'b'
         10        CONCAT                                           ~10     ~7, ~9
         11        ECHO                                                     ~10
   15    12      > RETURN                                                   null

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

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

End of function testclosures

End of class TestClosure.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.58 ms | 1395 KiB | 13 Q