3v4l.org

run code in 500+ PHP versions simultaneously
<?php $s = '{"1": "apple", "2": "banana", "3": "orange"}'; $jsonData = json_decode($s, true); $i = 1; $pairs = []; for($i = 1; $i < count($jsonData); ++$i) { $pair = [$jsonData[$i], $jsonData[$i + 1]]; $pairs[] = $pair; } print_r($pairs);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 10
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 10
Branch analysis from position: 22
Branch analysis from position: 10
filename:       /in/G6qQi
function name:  (null)
number of ops:  26
compiled vars:  !0 = $s, !1 = $jsonData, !2 = $i, !3 = $pairs, !4 = $pair
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%7B%221%22%3A+%22apple%22%2C+%222%22%3A+%22banana%22%2C+%223%22%3A+%22orange%22%7D'
    4     1        INIT_FCALL                                                   'json_decode'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     <true>
          4        DO_ICALL                                             $6      
          5        ASSIGN                                                       !1, $6
    6     6        ASSIGN                                                       !2, 1
    7     7        ASSIGN                                                       !3, <array>
    8     8        ASSIGN                                                       !2, 1
          9      > JMP                                                          ->19
    9    10    >   FETCH_DIM_R                                          ~11     !1, !2
         11        INIT_ARRAY                                           ~12     ~11
         12        ADD                                                  ~13     !2, 1
         13        FETCH_DIM_R                                          ~14     !1, ~13
         14        ADD_ARRAY_ELEMENT                                    ~12     ~14
         15        ASSIGN                                                       !4, ~12
   10    16        ASSIGN_DIM                                                   !3
         17        OP_DATA                                                      !4
    8    18        PRE_INC                                                      !2
         19    >   COUNT                                                ~18     !1
         20        IS_SMALLER                                                   !2, ~18
         21      > JMPNZ                                                        ~19, ->10
   12    22    >   INIT_FCALL                                                   'print_r'
         23        SEND_VAR                                                     !3
         24        DO_ICALL                                                     
         25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.15 ms | 2146 KiB | 15 Q