3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [1,25,60,100,110,150,155,167]; $range = []; foreach(array_chunk($arr, 2) as $rng){ $range = array_merge($range, range($rng[0], $rng[1])); } echo $range[array_rand($range)] . PHP_EOL; // Or shuffle($range); var_dump(array_slice($range, 0,10));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/kJUOE
function name:  (null)
number of ops:  39
compiled vars:  !0 = $arr, !1 = $range, !2 = $rng
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_chunk'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 2
          5        DO_ICALL                                         $5      
          6      > FE_RESET_R                                       $6      $5, ->20
          7    > > FE_FETCH_R                                               $6, !2, ->20
    7     8    >   INIT_FCALL                                               'array_merge'
          9        SEND_VAR                                                 !1
         10        INIT_FCALL                                               'range'
         11        FETCH_DIM_R                                      ~7      !2, 0
         12        SEND_VAL                                                 ~7
         13        FETCH_DIM_R                                      ~8      !2, 1
         14        SEND_VAL                                                 ~8
         15        DO_ICALL                                         $9      
         16        SEND_VAR                                                 $9
         17        DO_ICALL                                         $10     
         18        ASSIGN                                                   !1, $10
    6    19      > JMP                                                      ->7
         20    >   FE_FREE                                                  $6
   10    21        INIT_FCALL                                               'array_rand'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                         $12     
         24        FETCH_DIM_R                                      ~13     !1, $12
         25        CONCAT                                           ~14     ~13, '%0A'
         26        ECHO                                                     ~14
   13    27        INIT_FCALL                                               'shuffle'
         28        SEND_REF                                                 !1
         29        DO_ICALL                                                 
   14    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'array_slice'
         32        SEND_VAR                                                 !1
         33        SEND_VAL                                                 0
         34        SEND_VAL                                                 10
         35        DO_ICALL                                         $16     
         36        SEND_VAR                                                 $16
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.78 ms | 1018 KiB | 20 Q