3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['1','a','b','c']; echo "$array[2]". "\n"; echo $array [4]= 'd'."\n"; echo $array[]='f'."\n"; //aasocoative array $grosery=['chocolate'=>1, 'sugar'=>10, 'salt'=>3, 'apple'=>2, 'mango'=>5]; // ['1','a','b','c'], this isn't any differnt from the one on the left foreach($array as $key=>$thing) { echo $key . ' ' . $thing. "\n"; } foreach($grosery as $key=>$thing) { //btw, it is spelled grocery echo $key . ' ' . $thing. "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 29
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 29
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 20
filename:       /in/1Qi1A
function name:  (null)
number of ops:  31
compiled vars:  !0 = $array, !1 = $grosery, !2 = $thing, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        FETCH_DIM_R                                      ~5      !0, 2
          2        CAST                                          6  ~6      ~5
          3        CONCAT                                           ~7      ~6, '%0A'
          4        ECHO                                                     ~7
    4     5        ASSIGN_DIM                                       ~8      !0, 4
          6        OP_DATA                                                  'd%0A'
          7        ECHO                                                     ~8
    5     8        ASSIGN_DIM                                       ~9      !0
          9        OP_DATA                                                  'f%0A'
         10        ECHO                                                     ~9
    7    11        ASSIGN                                                   !1, <array>
   13    12      > FE_RESET_R                                       $11     !0, ->20
         13    > > FE_FETCH_R                                       ~12     $11, !2, ->20
         14    >   ASSIGN                                                   !3, ~12
   14    15        CONCAT                                           ~14     !3, '+'
         16        CONCAT                                           ~15     ~14, !2
         17        CONCAT                                           ~16     ~15, '%0A'
         18        ECHO                                                     ~16
   13    19      > JMP                                                      ->13
         20    >   FE_FREE                                                  $11
   17    21      > FE_RESET_R                                       $17     !1, ->29
         22    > > FE_FETCH_R                                       ~18     $17, !2, ->29
         23    >   ASSIGN                                                   !3, ~18
   18    24        CONCAT                                           ~20     !3, '+'
         25        CONCAT                                           ~21     ~20, !2
         26        CONCAT                                           ~22     ~21, '%0A'
         27        ECHO                                                     ~22
   17    28      > JMP                                                      ->22
         29    >   FE_FREE                                                  $17
   19    30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.19 ms | 1395 KiB | 13 Q