3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace{ function foo(){ echo "I'm (g)root!\n"; } function foo2(){ echo "I'm (g)root2!\n"; } function foo3(){ echo "I'm (g)root3!\n"; } } namespace Baz{ Class Test { function foobar(){ foo3(); } } Class Test2 { function foobar(){ foo3(); } } echo 'Function resolved at runtime so output changes' . "\n"; foo(); if(true){function foo(){ echo "I'm not (g)root!\n"; }} foo(); echo '------' . "\n"; echo 'Call for test purpose before Baz\foo3() has been defined' . "\n"; $test = new Test(); $test->foobar(); echo '------' . "\n"; echo 'Function resolved at parsing time so output does not change' . "\n"; foo2(); function foo2(){ echo "I'm not (g)root2!\n"; } foo2(); echo '------' . "\n"; echo 'Function resolved at runtime so output changes' . "\n"; foo3(); eval("namespace Baz; function foo3(){echo 'I\'m not (g)root3!\n';}"); foo3(); echo '------' . "\n"; echo 'Method has already been called so using the old version' . "\n"; $test->foobar(); echo 'Method is called for the first time so using the new version' . "\n"; $test2 = new Test2(); $test2->foobar(); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/IMmoO
function name:  (null)
number of ops:  38
compiled vars:  !0 = $test, !1 = $test2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ECHO                                                     'Function+resolved+at+runtime+so+output+changes%0A'
   24     1        INIT_NS_FCALL_BY_NAME                                    'Baz%5Cfoo'
          2        DO_FCALL                                      0          
   25     3      > JMPZ                                                     <true>, ->5
          4    >   DECLARE_FUNCTION                                         'baz%5Cfoo'
   26     5    >   INIT_NS_FCALL_BY_NAME                                    'Baz%5Cfoo'
          6        DO_FCALL                                      0          
   28     7        ECHO                                                     '------%0A'
   30     8        ECHO                                                     'Call+for+test+purpose+before+Baz%5Cfoo3%28%29+has+been+defined%0A'
   31     9        NEW                                              $4      'Baz%5CTest'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !0, $4
   32    12        INIT_METHOD_CALL                                         !0, 'foobar'
         13        DO_FCALL                                      0          
   34    14        ECHO                                                     '------%0A'
   36    15        ECHO                                                     'Function+resolved+at+parsing+time+so+output+does+not+change%0A'
   37    16        INIT_NS_FCALL_BY_NAME                                    'Baz%5Cfoo2'
         17        DO_FCALL                                      0          
   39    18        INIT_NS_FCALL_BY_NAME                                    'Baz%5Cfoo2'
         19        DO_FCALL                                      0          
   41    20        ECHO                                                     '------%0A'
   43    21        ECHO                                                     'Function+resolved+at+runtime+so+output+changes%0A'
   44    22        INIT_NS_FCALL_BY_NAME                                    'Baz%5Cfoo3'
         23        DO_FCALL                                      0          
   45    24        INCLUDE_OR_EVAL                                          'namespace+Baz%3B+function+foo3%28%29%7Becho+%27I%5C%27m+not+%28g%29root3%21%0A%27%3B%7D', EVAL
   46    25        INIT_NS_FCALL_BY_NAME                                    'Baz%5Cfoo3'
         26        DO_FCALL                                      0          
   48    27        ECHO                                                     '------%0A'
   50    28        ECHO                                                     'Method+has+already+been+called+so+using+the+old+version%0A'
   51    29        INIT_METHOD_CALL                                         !0, 'foobar'
         30        DO_FCALL                                      0          
   53    31        ECHO                                                     'Method+is+called+for+the+first+time+so+using+the+new+version%0A'
   54    32        NEW                                              $14     'Baz%5CTest2'
         33        DO_FCALL                                      0          
         34        ASSIGN                                                   !1, $14
   55    35        INIT_METHOD_CALL                                         !1, 'foobar'
         36        DO_FCALL                                      0          
   58    37      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IMmoO
function name:  foo
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                     'I%27m+%28g%29root%21%0A'
          1      > RETURN                                                   null

End of function foo

Function foo2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IMmoO
function name:  foo2
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'I%27m+%28g%29root2%21%0A'
          1      > RETURN                                                   null

End of function foo2

Function foo3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IMmoO
function name:  foo3
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ECHO                                                     'I%27m+%28g%29root3%21%0A'
          1      > RETURN                                                   null

End of function foo3

Function %00baz%5Cfoo%2Fin%2FIMmoO%3A25%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IMmoO
function name:  Baz\foo
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   ECHO                                                     'I%27m+not+%28g%29root%21%0A'
          1      > RETURN                                                   null

End of function %00baz%5Cfoo%2Fin%2FIMmoO%3A25%240

Function baz%5Cfoo2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IMmoO
function name:  Baz\foo2
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   ECHO                                                     'I%27m+not+%28g%29root2%21%0A'
          1      > RETURN                                                   null

End of function baz%5Cfoo2

Class Baz\Test:
Function foobar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IMmoO
function name:  foobar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_NS_FCALL_BY_NAME                                    'Baz%5Cfoo3'
          1        DO_FCALL                                      0          
   14     2      > RETURN                                                   null

End of function foobar

End of class Baz\Test.

Class Baz\Test2:
Function foobar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IMmoO
function name:  foobar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_NS_FCALL_BY_NAME                                    'Baz%5Cfoo3'
          1        DO_FCALL                                      0          
   20     2      > RETURN                                                   null

End of function foobar

End of class Baz\Test2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.24 ms | 1411 KiB | 21 Q