3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo\Bar; class A { } class B { public function __construct($type) { $fullType = 'Foo\\Bar\\' . $type; echo "try to create $fullType\n"; new $fullType; echo "$fullType created\n"; //$fullType = get_class($type . '::class'); echo "try to create $type::class ($fullType)\n"; $class = A::class; new $class; echo "$type::class ($fullType) created\n"; echo "try to create $type\n"; new $type; echo "$type created\n"; } } new A; new B('A');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nKqoP
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $0      'Foo%5CBar%5CA'
          1        DO_FCALL                                      0          
          2        FREE                                                     $0
   32     3        NEW                                              $2      'Foo%5CBar%5CB'
          4        SEND_VAL_EX                                              'A'
          5        DO_FCALL                                      0          
          6        FREE                                                     $2
          7      > RETURN                                                   1

Class Foo\Bar\A: [no user functions]
Class Foo\Bar\B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nKqoP
function name:  __construct
number of ops:  42
compiled vars:  !0 = $type, !1 = $fullType, !2 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        CONCAT                                           ~3      'Foo%5CBar%5C', !0
          2        ASSIGN                                                   !1, ~3
   15     3        ROPE_INIT                                     3  ~6      'try+to+create+'
          4        ROPE_ADD                                      1  ~6      ~6, !1
          5        ROPE_END                                      2  ~5      ~6, '%0A'
          6        ECHO                                                     ~5
   16     7        FETCH_CLASS                                   0  $8      !1
          8        NEW                                              $9      $8
          9        DO_FCALL                                      0          
         10        FREE                                                     $9
   17    11        NOP                                                      
         12        FAST_CONCAT                                      ~11     !1, '+created%0A'
         13        ECHO                                                     ~11
   20    14        ROPE_INIT                                     5  ~13     'try+to+create+'
         15        ROPE_ADD                                      1  ~13     ~13, !0
         16        ROPE_ADD                                      2  ~13     ~13, '%3A%3Aclass+%28'
         17        ROPE_ADD                                      3  ~13     ~13, !1
         18        ROPE_END                                      4  ~12     ~13, '%29%0A'
         19        ECHO                                                     ~12
   21    20        ASSIGN                                                   !2, 'Foo%5CBar%5CA'
   22    21        FETCH_CLASS                                   0  $17     !2
         22        NEW                                              $18     $17
         23        DO_FCALL                                      0          
         24        FREE                                                     $18
   23    25        ROPE_INIT                                     4  ~21     !0
         26        ROPE_ADD                                      1  ~21     ~21, '%3A%3Aclass+%28'
         27        ROPE_ADD                                      2  ~21     ~21, !1
         28        ROPE_END                                      3  ~20     ~21, '%29+created%0A'
         29        ECHO                                                     ~20
   25    30        ROPE_INIT                                     3  ~24     'try+to+create+'
         31        ROPE_ADD                                      1  ~24     ~24, !0
         32        ROPE_END                                      2  ~23     ~24, '%0A'
         33        ECHO                                                     ~23
   26    34        FETCH_CLASS                                   0  $26     !0
         35        NEW                                              $27     $26
         36        DO_FCALL                                      0          
         37        FREE                                                     $27
   27    38        NOP                                                      
         39        FAST_CONCAT                                      ~29     !0, '+created%0A'
         40        ECHO                                                     ~29
   28    41      > RETURN                                                   null

End of function __construct

End of class Foo\Bar\B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.53 ms | 1399 KiB | 13 Q