3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace A { class T {} } namespace { class Test { public function first(string $str) : Closure { return function() use ($str) : int { return strlen($str); }; } public function second(): self { return self; } } $t = new Test; echo ($t->second()->first("hello"))(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mToOC
function name:  (null)
number of ops:  12
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3        INIT_METHOD_CALL                                         !0, 'second'
          4        DO_FCALL                                      0  $4      
          5        INIT_METHOD_CALL                                         $4, 'first'
          6        SEND_VAL_EX                                              'hello'
          7        DO_FCALL                                      0  $5      
          8        INIT_DYNAMIC_CALL                                        $5
          9        DO_FCALL                                      0  $6      
         10        ECHO                                                     $6
   25    11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FmToOC%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mToOC
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   BIND_STATIC                                              !0
   13     1        STRLEN                                           ~1      !0
          2        VERIFY_RETURN_TYPE                                       ~1
          3      > RETURN                                                   ~1
   14     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

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

Class A\T: [no user functions]
Class Test:
Function first:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mToOC
function name:  first
number of ops:  7
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FmToOC%3A12%240'
          2        BIND_LEXICAL                                             ~1, !0
   14     3        VERIFY_RETURN_TYPE                                       ~1
          4      > RETURN                                                   ~1
   15     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function first

Function second:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mToOC
function name:  second
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_CONSTANT                                   ~0      'self'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   20     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function second

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.62 ms | 1390 KiB | 13 Q