3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('TEST_VALUE_COUNT', 10); srand(15); $values = array(); for ($i = 0; $i < TEST_VALUE_COUNT; $i++) { $values[] = rand(); } srand(15); foreach($values as $key => $value) { if ($value !== rand()) { print "Bad value at " . $key; exit; } } echo "All were the same in " . count($values) . " values\n"; srand(15); shuffle($values); $valuesShuffled = $values; var_dump($valuesShuffled); srand(15); shuffle($values); if (count(array_diff_assoc($values, $valuesShuffled)) == 0) { echo "Array was the same after a seeded shuffle"; } else { echo "Array was not the same after a seeded shuffle\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 10
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 32
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 32
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 31
Branch analysis from position: 28
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 62
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 10
Branch analysis from position: 18
Branch analysis from position: 10
filename:       /in/WtAn5
function name:  (null)
number of ops:  64
compiled vars:  !0 = $values, !1 = $i, !2 = $value, !3 = $key, !4 = $valuesShuffled
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'TEST_VALUE_COUNT'
          2        SEND_VAL                                                 10
          3        DO_ICALL                                                 
    5     4        INIT_FCALL                                               'srand'
          5        SEND_VAL                                                 15
          6        DO_ICALL                                                 
    7     7        ASSIGN                                                   !0, <array>
    9     8        ASSIGN                                                   !1, 0
          9      > JMP                                                      ->15
   10    10    >   INIT_FCALL                                               'rand'
         11        DO_ICALL                                         $10     
         12        ASSIGN_DIM                                               !0
         13        OP_DATA                                                  $10
    9    14        PRE_INC                                                  !1
         15    >   FETCH_CONSTANT                                   ~12     'TEST_VALUE_COUNT'
         16        IS_SMALLER                                               !1, ~12
         17      > JMPNZ                                                    ~13, ->10
   13    18    >   INIT_FCALL                                               'srand'
         19        SEND_VAL                                                 15
         20        DO_ICALL                                                 
   15    21      > FE_RESET_R                                       $15     !0, ->32
         22    > > FE_FETCH_R                                       ~16     $15, !2, ->32
         23    >   ASSIGN                                                   !3, ~16
   16    24        INIT_FCALL                                               'rand'
         25        DO_ICALL                                         $18     
         26        IS_NOT_IDENTICAL                                         !2, $18
         27      > JMPZ                                                     ~19, ->31
   17    28    >   CONCAT                                           ~20     'Bad+value+at+', !3
         29        ECHO                                                     ~20
   18    30      > EXIT                                                     
   15    31    > > JMP                                                      ->22
         32    >   FE_FREE                                                  $15
   22    33        COUNT                                            ~21     !0
         34        CONCAT                                           ~22     'All+were+the+same+in+', ~21
         35        CONCAT                                           ~23     ~22, '+values%0A'
         36        ECHO                                                     ~23
   24    37        INIT_FCALL                                               'srand'
         38        SEND_VAL                                                 15
         39        DO_ICALL                                                 
   26    40        INIT_FCALL                                               'shuffle'
         41        SEND_REF                                                 !0
         42        DO_ICALL                                                 
   28    43        ASSIGN                                                   !4, !0
   29    44        INIT_FCALL                                               'var_dump'
         45        SEND_VAR                                                 !4
         46        DO_ICALL                                                 
   31    47        INIT_FCALL                                               'srand'
         48        SEND_VAL                                                 15
         49        DO_ICALL                                                 
   33    50        INIT_FCALL                                               'shuffle'
         51        SEND_REF                                                 !0
         52        DO_ICALL                                                 
   35    53        INIT_FCALL                                               'array_diff_assoc'
         54        SEND_VAR                                                 !0
         55        SEND_VAR                                                 !4
         56        DO_ICALL                                         $30     
         57        COUNT                                            ~31     $30
         58        IS_EQUAL                                                 ~31, 0
         59      > JMPZ                                                     ~32, ->62
   36    60    >   ECHO                                                     'Array+was+the+same+after+a+seeded+shuffle'
         61      > JMP                                                      ->63
   38    62    >   ECHO                                                     'Array+was+not+the+same+after+a+seeded+shuffle%0A'
   39    63    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.68 ms | 1400 KiB | 25 Q