3v4l.org

run code in 300+ PHP versions simultaneously
<?php $id = [11,12,13,56,34,23,34]; $code = ['1234','5678','9012','4343','4543','4642','534']; $qty = [3,4,5,6,7,8,3]; $amount = [12.34,23.45,34.56,66.34,75.32,54.3,23.2]; $loopRun = 0; $max = count($id); $data = []; for ($i=0; $i<ceil($max/2); $i++) { $loopRun++; $data[$i] = [ 'id' => $id[$i], 'code' => $code[$i], 'qty' => $qty[$i], 'amount' => $amount[$i] ]; $data[$max-($i+1)] = [ 'id' => $id[$max-($i+1)], 'code' => $code[$max-($i+1)], 'qty' => $qty[$max-($i+1)], 'amount' => $amount[$max-($i+1)] ]; } ksort($data); echo "Loop Run Count : ".$loopRun."\n\n"; print_r($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 10
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 10
Branch analysis from position: 48
Branch analysis from position: 10
filename:       /in/GDDu6
function name:  (null)
number of ops:  58
compiled vars:  !0 = $id, !1 = $code, !2 = $qty, !3 = $amount, !4 = $loopRun, !5 = $max, !6 = $data, !7 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, <array>
    7     3        ASSIGN                                                   !3, <array>
    9     4        ASSIGN                                                   !4, 0
   10     5        COUNT                                            ~13     !0
          6        ASSIGN                                                   !5, ~13
   11     7        ASSIGN                                                   !6, <array>
   12     8        ASSIGN                                                   !7, 0
          9      > JMP                                                      ->42
   13    10    >   PRE_INC                                                  !4
   15    11        FETCH_DIM_R                                      ~19     !0, !7
         12        INIT_ARRAY                                       ~20     ~19, 'id'
   16    13        FETCH_DIM_R                                      ~21     !1, !7
         14        ADD_ARRAY_ELEMENT                                ~20     ~21, 'code'
   17    15        FETCH_DIM_R                                      ~22     !2, !7
         16        ADD_ARRAY_ELEMENT                                ~20     ~22, 'qty'
   18    17        FETCH_DIM_R                                      ~23     !3, !7
         18        ADD_ARRAY_ELEMENT                                ~20     ~23, 'amount'
   14    19        ASSIGN_DIM                                               !6, !7
   18    20        OP_DATA                                                  ~20
   21    21        ADD                                              ~24     !7, 1
         22        SUB                                              ~25     !5, ~24
   22    23        ADD                                              ~27     !7, 1
         24        SUB                                              ~28     !5, ~27
         25        FETCH_DIM_R                                      ~29     !0, ~28
         26        INIT_ARRAY                                       ~30     ~29, 'id'
   23    27        ADD                                              ~31     !7, 1
         28        SUB                                              ~32     !5, ~31
         29        FETCH_DIM_R                                      ~33     !1, ~32
         30        ADD_ARRAY_ELEMENT                                ~30     ~33, 'code'
   24    31        ADD                                              ~34     !7, 1
         32        SUB                                              ~35     !5, ~34
         33        FETCH_DIM_R                                      ~36     !2, ~35
         34        ADD_ARRAY_ELEMENT                                ~30     ~36, 'qty'
   25    35        ADD                                              ~37     !7, 1
         36        SUB                                              ~38     !5, ~37
         37        FETCH_DIM_R                                      ~39     !3, ~38
         38        ADD_ARRAY_ELEMENT                                ~30     ~39, 'amount'
   21    39        ASSIGN_DIM                                               !6, ~25
   25    40        OP_DATA                                                  ~30
   12    41        PRE_INC                                                  !7
         42    >   INIT_FCALL                                               'ceil'
         43        DIV                                              ~41     !5, 2
         44        SEND_VAL                                                 ~41
         45        DO_ICALL                                         $42     
         46        IS_SMALLER                                               !7, $42
         47      > JMPNZ                                                    ~43, ->10
   28    48    >   INIT_FCALL                                               'ksort'
         49        SEND_REF                                                 !6
         50        DO_ICALL                                                 
   29    51        CONCAT                                           ~45     'Loop+Run+Count+%3A+', !4
         52        CONCAT                                           ~46     ~45, '%0A%0A'
         53        ECHO                                                     ~46
   30    54        INIT_FCALL                                               'print_r'
         55        SEND_VAR                                                 !6
         56        DO_ICALL                                                 
         57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.71 ms | 1009 KiB | 16 Q