3v4l.org

run code in 300+ PHP versions simultaneously
<?php $names = ['Adamino', 'Pete', 'Mark', 'Gonz']; $pairs = []; $iteration = 0; while (count($names) > 0) { ++$iteration; if ($iteration > 10) break; $plucked = array_rand($names, 2); $pair = [$names[$plucked[0]], $names[$plucked[1]]]; unset($names[$plucked[0]], $names[$plucked[1]]); $pairs[] = $pair; } $result = "The PP randomizer has selected: \n"; foreach ($pairs as $p) { $result .= " -> {$p[0]} and {$p[1]}\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 4
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 41
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 41
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 4
Branch analysis from position: 29
Branch analysis from position: 4
filename:       /in/A54Dk
function name:  (null)
number of ops:  43
compiled vars:  !0 = $names, !1 = $pairs, !2 = $iteration, !3 = $plucked, !4 = $pair, !5 = $result, !6 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    8     2        ASSIGN                                                   !2, 0
    9     3      > JMP                                                      ->26
   10     4    >   PRE_INC                                                  !2
          5        IS_SMALLER                                               10, !2
          6      > JMPZ                                                     ~11, ->8
          7    > > JMP                                                      ->29
   12     8    >   INIT_FCALL                                               'array_rand'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 2
         11        DO_ICALL                                         $12     
         12        ASSIGN                                                   !3, $12
   14    13        FETCH_DIM_R                                      ~14     !3, 0
         14        FETCH_DIM_R                                      ~15     !0, ~14
         15        INIT_ARRAY                                       ~16     ~15
         16        FETCH_DIM_R                                      ~17     !3, 1
         17        FETCH_DIM_R                                      ~18     !0, ~17
         18        ADD_ARRAY_ELEMENT                                ~16     ~18
         19        ASSIGN                                                   !4, ~16
   15    20        FETCH_DIM_R                                      ~20     !3, 0
         21        UNSET_DIM                                                !0, ~20
         22        FETCH_DIM_R                                      ~21     !3, 1
         23        UNSET_DIM                                                !0, ~21
   17    24        ASSIGN_DIM                                               !1
         25        OP_DATA                                                  !4
    9    26    >   COUNT                                            ~23     !0
         27        IS_SMALLER                                               0, ~23
         28      > JMPNZ                                                    ~24, ->4
   20    29    >   ASSIGN                                                   !5, 'The+PP+randomizer+has+selected%3A+%0A'
   21    30      > FE_RESET_R                                       $26     !1, ->41
         31    > > FE_FETCH_R                                               $26, !6, ->41
   22    32    >   ROPE_INIT                                     5  ~30     '+-%3E+'
         33        FETCH_DIM_R                                      ~27     !6, 0
         34        ROPE_ADD                                      1  ~30     ~30, ~27
         35        ROPE_ADD                                      2  ~30     ~30, '+and+'
         36        FETCH_DIM_R                                      ~28     !6, 1
         37        ROPE_ADD                                      3  ~30     ~30, ~28
         38        ROPE_END                                      4  ~29     ~30, '%0A'
         39        ASSIGN_OP                                     8          !5, ~29
   21    40      > JMP                                                      ->31
         41    >   FE_FREE                                                  $26
   23    42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.11 ms | 1400 KiB | 15 Q