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"; srand(15); shuffle($values); var_dump($values); $valuesShuffled = array_merge(array(), $values); srand(15); shuffle($values); var_dump($valuesShuffled); var_dump($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 = 70, Position 2 = 72
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
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/WgF4d
function name:  (null)
number of ops:  74
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'
         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        INIT_FCALL                                               'var_dump'
         44        SEND_VAR                                                 !0
         45        DO_ICALL                                                 
   30    46        INIT_FCALL                                               'array_merge'
         47        SEND_VAL                                                 <array>
         48        SEND_VAR                                                 !0
         49        DO_ICALL                                         $27     
         50        ASSIGN                                                   !4, $27
   32    51        INIT_FCALL                                               'srand'
         52        SEND_VAL                                                 15
         53        DO_ICALL                                                 
   34    54        INIT_FCALL                                               'shuffle'
         55        SEND_REF                                                 !0
         56        DO_ICALL                                                 
   36    57        INIT_FCALL                                               'var_dump'
         58        SEND_VAR                                                 !4
         59        DO_ICALL                                                 
   37    60        INIT_FCALL                                               'var_dump'
         61        SEND_VAR                                                 !0
         62        DO_ICALL                                                 
   39    63        INIT_FCALL                                               'array_diff_assoc'
         64        SEND_VAR                                                 !0
         65        SEND_VAR                                                 !4
         66        DO_ICALL                                         $33     
         67        COUNT                                            ~34     $33
         68        IS_EQUAL                                                 ~34, 0
         69      > JMPZ                                                     ~35, ->72
   40    70    >   ECHO                                                     'Array+was+the+same+after+a+seeded+shuffle'
         71      > JMP                                                      ->73
   42    72    >   ECHO                                                     'Array+was+not+the+same+after+a+seeded+shuffle%0A'
   43    73    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.85 ms | 1400 KiB | 27 Q