3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Enter your code here, enjoy! $ar = array("1","2","3","4","5","6"); $st = 2; $en = 4; function arrayRangeRand(&$arr, $s, $e){ $tmp = []; for($i=$s;$i<=$e;$i++){ $tmp[] = $arr[$i]; } shuffle($tmp); foreach($tmp as $ind=>$val){ $arr[$s+$ind] = $val; } } arrayRangeRand($ar, $st, $en); print_r($ar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Wtqp
function name:  (null)
number of ops:  12
compiled vars:  !0 = $ar, !1 = $st, !2 = $en
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, 2
    7     2        ASSIGN                                                   !2, 4
   19     3        INIT_FCALL                                               'arrayrangerand'
          4        SEND_REF                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        DO_FCALL                                      0          
   20     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function arrayrangerand:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 6
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 6
Branch analysis from position: 12
Branch analysis from position: 6
filename:       /in/2Wtqp
function name:  arrayRangeRand
number of ops:  24
compiled vars:  !0 = $arr, !1 = $s, !2 = $e, !3 = $tmp, !4 = $i, !5 = $val, !6 = $ind
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   10     3        ASSIGN                                                   !3, <array>
   11     4        ASSIGN                                                   !4, !1
          5      > JMP                                                      ->10
   12     6    >   FETCH_DIM_R                                      ~10     !0, !4
          7        ASSIGN_DIM                                               !3
          8        OP_DATA                                                  ~10
   11     9        PRE_INC                                                  !4
         10    >   IS_SMALLER_OR_EQUAL                                      !4, !2
         11      > JMPNZ                                                    ~12, ->6
   14    12    >   INIT_FCALL                                               'shuffle'
         13        SEND_REF                                                 !3
         14        DO_ICALL                                                 
   15    15      > FE_RESET_R                                       $14     !3, ->22
         16    > > FE_FETCH_R                                       ~15     $14, !5, ->22
         17    >   ASSIGN                                                   !6, ~15
   16    18        ADD                                              ~17     !1, !6
         19        ASSIGN_DIM                                               !0, ~17
         20        OP_DATA                                                  !5
   15    21      > JMP                                                      ->16
         22    >   FE_FREE                                                  $14
   18    23      > RETURN                                                   null

End of function arrayrangerand

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.85 ms | 1008 KiB | 16 Q