3v4l.org

run code in 300+ PHP versions simultaneously
<?php $great = 'abc'; ${'great '} = 'def'; const great = 'ghi'; $ghi = '...'; ${"ෝ"} = 'Meh'; // ${\u{ddd}} = 'Meh'; var_dump("${great }"); // outputs the constant value's variable value var_dump("${'great '}"); // outputs the ${'great '} variable value var_dump("${great}"); // outputs the $great variable value var_dump("${'ෝ'}"); // outputs the ${\u{ddd}} variable value var_dump("${ෝ}"); // outputs the ${\u{ddd}} variable value /* Even though "great " is not a valid variable name, neither is "\u{ddd}" but that still works. I'd therefore expect "${great }" to firstly search for a variable named "great " before falling back to evaluating the expression first. */
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fC2vh
function name:  (null)
number of ops:  28
compiled vars:  !0 = $great, !1 = $great , !2 = $ghi, !3 = $ෝ
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'abc'
    4     1        ASSIGN                                                   !1, 'def'
    5     2        DECLARE_CONST                                            'great', 'ghi'
    6     3        ASSIGN                                                   !2, '...'
    7     4        ASSIGN                                                   !3, 'Meh'
    9     5        INIT_FCALL                                               'var_dump'
          6        FETCH_CONSTANT                                   ~8      'great'
          7        FETCH_R                      local               ~9      ~8
          8        CAST                                          6  ~10     ~9
          9        SEND_VAL                                                 ~10
         10        DO_ICALL                                                 
   10    11        INIT_FCALL                                               'var_dump'
         12        CAST                                          6  ~12     !1
         13        SEND_VAL                                                 ~12
         14        DO_ICALL                                                 
   11    15        INIT_FCALL                                               'var_dump'
         16        CAST                                          6  ~14     !0
         17        SEND_VAL                                                 ~14
         18        DO_ICALL                                                 
   12    19        INIT_FCALL                                               'var_dump'
         20        CAST                                          6  ~16     !3
         21        SEND_VAL                                                 ~16
         22        DO_ICALL                                                 
   13    23        INIT_FCALL                                               'var_dump'
         24        CAST                                          6  ~18     !3
         25        SEND_VAL                                                 ~18
         26        DO_ICALL                                                 
   20    27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.83 ms | 1400 KiB | 15 Q