3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(1 => 5, 0 => 5); echo "first array\n"; print_r($array); $output = Array(); foreach ($array as $key => $value) { echo "$key => $value \n"; $output[] = array("id" => $key, "score" => $value); } echo "secont array\n"; print_r($output);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/uMYPe
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $output, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ECHO                                                     'first+array%0A'
    4     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    6     5        ASSIGN                                                   !1, <array>
    8     6      > FE_RESET_R                                       $7      !0, ->19
          7    > > FE_FETCH_R                                       ~8      $7, !2, ->19
          8    >   ASSIGN                                                   !3, ~8
    9     9        ROPE_INIT                                     4  ~11     !3
         10        ROPE_ADD                                      1  ~11     ~11, '+%3D%3E+'
         11        ROPE_ADD                                      2  ~11     ~11, !2
         12        ROPE_END                                      3  ~10     ~11, '+%0A'
         13        ECHO                                                     ~10
   10    14        INIT_ARRAY                                       ~14     !3, 'id'
         15        ADD_ARRAY_ELEMENT                                ~14     !2, 'score'
         16        ASSIGN_DIM                                               !1
         17        OP_DATA                                                  ~14
    8    18      > JMP                                                      ->7
         19    >   FE_FREE                                                  $7
   13    20        ECHO                                                     'secont+array%0A'
   14    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.67 ms | 1395 KiB | 15 Q