3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vacancies = 13; $list_order_id = [1, 5, 6, 9, 10]; $last_id = 6; $count = count($list_order_id); $index = array_search($last_id, $list_order_id); $result = []; for ($i = 0; $i < $vacancies; ++$i) { $result[] = $list_order_id[++$index % $count]; } var_export($result);
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 = 21, Position 2 = 13
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 13
Branch analysis from position: 21
Branch analysis from position: 13
filename:       /in/lSTsi
function name:  (null)
number of ops:  25
compiled vars:  !0 = $vacancies, !1 = $list_order_id, !2 = $last_id, !3 = $count, !4 = $index, !5 = $result, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 13
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, 6
    7     3        COUNT                                            ~10     !1
          4        ASSIGN                                                   !3, ~10
    8     5        INIT_FCALL                                               'array_search'
          6        SEND_VAR                                                 !2
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $12     
          9        ASSIGN                                                   !4, $12
    9    10        ASSIGN                                                   !5, <array>
   10    11        ASSIGN                                                   !6, 0
         12      > JMP                                                      ->19
   11    13    >   PRE_INC                                          ~17     !4
         14        MOD                                              ~18     ~17, !3
         15        FETCH_DIM_R                                      ~19     !1, ~18
         16        ASSIGN_DIM                                               !5
         17        OP_DATA                                                  ~19
   10    18        PRE_INC                                                  !6
         19    >   IS_SMALLER                                               !6, !0
         20      > JMPNZ                                                    ~21, ->13
   13    21    >   INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !5
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.64 ms | 999 KiB | 15 Q