3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo\Bar { class Baz { function now() { return time(); } } } namespace { class Test { public static $now; function register() { $namespace = 'Foo\\Bar'; eval('namespace '.$namespace.' { function time() { return \\'.__CLASS__.'::$now ?: \time(); } }'); } } $b = new Foo\Bar\Baz(); $t = new Test(); $t->register(); Test::$now = 'xxx'; echo $b->now(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L2l45
function name:  (null)
number of ops:  14
compiled vars:  !0 = $b, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $2      'Foo%5CBar%5CBaz'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   27     3        NEW                                              $5      'Test'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   29     6        INIT_METHOD_CALL                                         !1, 'register'
          7        DO_FCALL                                      0          
   30     8        ASSIGN_STATIC_PROP                                       'now', 'Test'
          9        OP_DATA                                                  'xxx'
   32    10        INIT_METHOD_CALL                                         !0, 'now'
         11        DO_FCALL                                      0  $10     
         12        ECHO                                                     $10
   33    13      > RETURN                                                   1

Class Foo\Bar\Baz:
Function now:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L2l45
function name:  now
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_NS_FCALL_BY_NAME                                    'Foo%5CBar%5Ctime'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
    7     3*     > RETURN                                                   null

End of function now

End of class Foo\Bar\Baz.

Class Test:
Function register:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L2l45
function name:  register
number of ops:  7
compiled vars:  !0 = $namespace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, 'Foo%5CBar'
   17     1        CONCAT                                           ~2      'namespace+', !0
          2        CONCAT                                           ~3      ~2, '+%7B%0A++++++++++++++++function+time%28%29%0A%09%09%09%09%7B%0A++++++++++++++++++++return+%5C'
   20     3        CONCAT                                           ~4      ~3, 'Test'
          4        CONCAT                                           ~5      ~4, '%3A%3A%24now+%3F%3A+%5Ctime%28%29%3B%0A++++++++++++++++%7D%0A++++++++++++%7D'
          5        INCLUDE_OR_EVAL                                          ~5, EVAL
   23     6      > RETURN                                                   null

End of function register

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.14 ms | 1396 KiB | 15 Q