3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo; class Bar {} $object = new Bar(); var_dump($object::class); echo "\n"; $string = 'whatever'; var_dump(whatever::class); var_dump('whatever'::class); // Why does this work... var_dump($string::class); // ... while this doesn't?
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rlZFF
function name:  (null)
number of ops:  20
compiled vars:  !0 = $object, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $2      'Foo%5CBar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    9     3        INIT_NS_FCALL_BY_NAME                                    'Foo%5Cvar_dump'
          4        FETCH_CLASS_NAME                                 ~5      !0
          5        SEND_VAL_EX                                              ~5
          6        DO_FCALL                                      0          
   11     7        ECHO                                                     '%0A'
   13     8        ASSIGN                                                   !1, 'whatever'
   15     9        INIT_NS_FCALL_BY_NAME                                    'Foo%5Cvar_dump'
         10        SEND_VAL_EX                                              'Foo%5Cwhatever'
         11        DO_FCALL                                      0          
   16    12        INIT_NS_FCALL_BY_NAME                                    'Foo%5Cvar_dump'
         13        SEND_VAL_EX                                              'whatever'
         14        DO_FCALL                                      0          
   17    15        INIT_NS_FCALL_BY_NAME                                    'Foo%5Cvar_dump'
         16        FETCH_CLASS_NAME                                 ~10     !1
         17        SEND_VAL_EX                                              ~10
         18        DO_FCALL                                      0          
         19      > RETURN                                                   1

Class Foo\Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.1 ms | 1395 KiB | 15 Q