3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Route { public static $routes = array(); public function get($path,$route) { static::$routes[$path] = $route; } public function run() { foreach (static::$routes as $route) echo $route(); } } Route::get('home', function() { return 'hello'; }); Route::run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OJEa7
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'Route', 'get'
          1        SEND_VAL                                                 'home'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FOJEa7%3A23%240'
   27     3        SEND_VAL                                                 ~0
          4        DO_FCALL                                      0          
   30     5        INIT_STATIC_METHOD_CALL                                  'Route', 'run'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FOJEa7%3A23%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OJEa7
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E > > RETURN                                                   'hello'
   27     1*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FOJEa7%3A23%240

Class Route:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OJEa7
function name:  get
number of ops:  6
compiled vars:  !0 = $path, !1 = $route
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        FETCH_STATIC_PROP_W          global              $2      'routes'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   11     5      > RETURN                                                   null

End of function get

Function run:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/OJEa7
function name:  run
number of ops:  9
compiled vars:  !0 = $route
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_STATIC_PROP_R          unknown             ~1      'routes'
          1      > FE_RESET_R                                       $2      ~1, ->7
          2    > > FE_FETCH_R                                               $2, !0, ->7
   17     3    >   INIT_DYNAMIC_CALL                                        !0
          4        DO_FCALL                                      0  $3      
          5        ECHO                                                     $3
   15     6      > JMP                                                      ->2
          7    >   FE_FREE                                                  $2
   19     8      > RETURN                                                   null

End of function run

End of class Route.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.6 ms | 1386 KiB | 13 Q