3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tmp = array('id' => 'blah'); if (1==1) { $sql = "some sql statement $tmp[id]"; echo $sql; } //^ that is not working $sql prints as empty but if I do : if (1==1) { $anything = $tmp['id']; $sql = "some sql statement $tmp[id]"; echo $sql; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 7
filename:       /in/bnRv5
function name:  (null)
number of ops:  16
compiled vars:  !0 = $tmp, !1 = $sql, !2 = $anything
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1      > JMPZ                                                     <true>, ->7
    4     2    >   NOP                                                      
          3        FETCH_DIM_R                                      ~4      !0, 'id'
          4        FAST_CONCAT                                      ~5      'some+sql+statement+', ~4
          5        ASSIGN                                                   !1, ~5
    5     6        ECHO                                                     !1
   10     7    > > JMPZ                                                     <true>, ->15
   11     8    >   FETCH_DIM_R                                      ~7      !0, 'id'
          9        ASSIGN                                                   !2, ~7
   12    10        NOP                                                      
         11        FETCH_DIM_R                                      ~9      !0, 'id'
         12        FAST_CONCAT                                      ~10     'some+sql+statement+', ~9
         13        ASSIGN                                                   !1, ~10
   13    14        ECHO                                                     !1
   14    15    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.53 ms | 1384 KiB | 13 Q