3v4l.org

run code in 500+ PHP versions simultaneously
<?php $object = new DateTime(); 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/hfvXm
function name:  (null)
number of ops:  20
compiled vars:  !0 = $object, !1 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   NEW                                                  $2      'DateTime'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
    5     3        INIT_FCALL                                                   'var_dump'
          4        FETCH_CLASS_NAME                                     ~5      !0
          5        SEND_VAL                                                     ~5
          6        DO_ICALL                                                     
    7     7        ECHO                                                         '%0A'
    9     8        ASSIGN                                                       !1, 'whatever'
   11     9        INIT_FCALL                                                   'var_dump'
         10        SEND_VAL                                                     'whatever'
         11        DO_ICALL                                                     
   12    12        INIT_FCALL                                                   'var_dump'
         13        SEND_VAL                                                     'whatever'
         14        DO_ICALL                                                     
   13    15        INIT_FCALL                                                   'var_dump'
         16        FETCH_CLASS_NAME                                     ~10     !1
         17        SEND_VAL                                                     ~10
         18        DO_ICALL                                                     
         19      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
151.95 ms | 2034 KiB | 14 Q