3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Nested\Name; class Test { public static function speak(string | object $name) { if (is_string($name)) { var_dump($name); } else { var_dump($name::class); } } } class Name{} Test::speak(Name::class); Test::speak(new Name);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W0LTM
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_STATIC_METHOD_CALL                                  'Nested%5CName%5CTest', 'speak'
          1        SEND_VAL                                                 'Nested%5CName%5CName'
          2        DO_FCALL                                      0          
   21     3        INIT_STATIC_METHOD_CALL                                  'Nested%5CName%5CTest', 'speak'
          4        NEW                                              $1      'Nested%5CName%5CName'
          5        DO_FCALL                                      0          
          6        SEND_VAR                                                 $1
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class Nested\Name\Test:
Function speak:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W0LTM
function name:  speak
number of ops:  14
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_NS_FCALL_BY_NAME                                    'Nested%5CName%5Cis_string'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > JMPZ                                                     $1, ->9
   10     5    >   INIT_NS_FCALL_BY_NAME                                    'Nested%5CName%5Cvar_dump'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8      > JMP                                                      ->13
   13     9    >   INIT_NS_FCALL_BY_NAME                                    'Nested%5CName%5Cvar_dump'
         10        FETCH_CLASS_NAME                                 ~3      !0
         11        SEND_VAL_EX                                              ~3
         12        DO_FCALL                                      0          
   15    13    > > RETURN                                                   null

End of function speak

End of class Nested\Name\Test.

Class Nested\Name\Name: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.36 ms | 1396 KiB | 17 Q