3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo { class Bar { }; } namespace { use Foo\Bar; class_alias(Bar::class, 'FooBar'); class GuineaPig { public function withNamespace(Bar $bar) { echo sprintf("Passing %s worked with %s\n", get_class($bar), __METHOD__); } public function withoutNamespace(FooBar $bar) { echo sprintf("Passing %s worked with %s\n", get_class($bar), __METHOD__); } } $bar = new Bar(); $foobar = new FooBar(); $pig = new GuineaPig(); $pig->withNamespace($bar); $pig->withNamespace($foobar); $pig->withoutNamespace($bar); $pig->withoutNamespace($foobar); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s1AlG
function name:  (null)
number of ops:  26
compiled vars:  !0 = $bar, !1 = $foobar, !2 = $pig
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'class_alias'
          1        SEND_VAL                                                 'Foo%5CBar'
          2        SEND_VAL                                                 'FooBar'
          3        DO_ICALL                                                 
   27     4        NEW                                              $4      'Foo%5CBar'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $4
   28     7        NEW                                              $7      'FooBar'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $7
   29    10        NEW                                              $10     'GuineaPig'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $10
   31    13        INIT_METHOD_CALL                                         !2, 'withNamespace'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0          
   32    16        INIT_METHOD_CALL                                         !2, 'withNamespace'
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0          
   33    19        INIT_METHOD_CALL                                         !2, 'withoutNamespace'
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0          
   34    22        INIT_METHOD_CALL                                         !2, 'withoutNamespace'
         23        SEND_VAR_EX                                              !1
         24        DO_FCALL                                      0          
   35    25      > RETURN                                                   1

Class Foo\Bar: [no user functions]
Class GuineaPig:
Function withnamespace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s1AlG
function name:  withNamespace
number of ops:  9
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'sprintf'
          2        SEND_VAL                                                 'Passing+%25s+worked+with+%25s%0A'
          3        GET_CLASS                                        ~1      !0
          4        SEND_VAL                                                 ~1
          5        SEND_VAL                                                 'GuineaPig%3A%3AwithNamespace'
          6        DO_ICALL                                         $2      
          7        ECHO                                                     $2
   19     8      > RETURN                                                   null

End of function withnamespace

Function withoutnamespace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s1AlG
function name:  withoutNamespace
number of ops:  9
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        INIT_FCALL                                               'sprintf'
          2        SEND_VAL                                                 'Passing+%25s+worked+with+%25s%0A'
          3        GET_CLASS                                        ~1      !0
          4        SEND_VAL                                                 ~1
          5        SEND_VAL                                                 'GuineaPig%3A%3AwithoutNamespace'
          6        DO_ICALL                                         $2      
          7        ECHO                                                     $2
   24     8      > RETURN                                                   null

End of function withoutnamespace

End of class GuineaPig.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.83 ms | 1004 KiB | 15 Q