3v4l.org

run code in 500+ PHP versions simultaneously
<?php mt_srand(42); $first = [mt_rand(), rand()]; mt_srand(42); echo 'mt_rand/rand repeat after mt_srand(): ', var_export($first === [mt_rand(), rand()], true), "\n"; mt_srand(42); $first = @lcg_value(); mt_srand(42); echo 'lcg_value repeats after mt_srand(): ', var_export($first === @lcg_value(), true), "\n"; srand(42); $first = @lcg_value(); srand(42); echo 'lcg_value repeats after srand(): ', var_export($first === @lcg_value(), true), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nSWqO
function name:  (null)
number of ops:  74
compiled vars:  !0 = $first
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'mt_srand'
          1        SEND_VAL                                                     42
          2        DO_ICALL                                                     
    4     3        INIT_FCALL                                                   'mt_rand'
          4        DO_ICALL                                             $2      
          5        INIT_ARRAY                                           ~3      $2
          6        INIT_FCALL                                                   'rand'
          7        DO_ICALL                                             $4      
          8        ADD_ARRAY_ELEMENT                                    ~3      $4
          9        ASSIGN                                                       !0, ~3
    5    10        INIT_FCALL                                                   'mt_srand'
         11        SEND_VAL                                                     42
         12        DO_ICALL                                                     
    6    13        ECHO                                                         'mt_rand%2Frand+repeat+after+mt_srand%28%29%3A+'
         14        INIT_FCALL                                                   'var_export'
         15        INIT_FCALL                                                   'mt_rand'
         16        DO_ICALL                                             $7      
         17        INIT_ARRAY                                           ~8      $7
         18        INIT_FCALL                                                   'rand'
         19        DO_ICALL                                             $9      
         20        ADD_ARRAY_ELEMENT                                    ~8      $9
         21        IS_IDENTICAL                                         ~10     !0, ~8
         22        SEND_VAL                                                     ~10
         23        SEND_VAL                                                     <true>
         24        DO_ICALL                                             $11     
         25        ECHO                                                         $11
         26        ECHO                                                         '%0A'
    8    27        INIT_FCALL                                                   'mt_srand'
         28        SEND_VAL                                                     42
         29        DO_ICALL                                                     
    9    30        BEGIN_SILENCE                                        ~13     
         31        INIT_FCALL                                                   'lcg_value'
         32        DO_FCALL_BY_NAME                                             
         33        END_SILENCE                                                  ~13
         34        ASSIGN                                                       !0, $14
   10    35        INIT_FCALL                                                   'mt_srand'
         36        SEND_VAL                                                     42
         37        DO_ICALL                                                     
   11    38        ECHO                                                         'lcg_value+repeats+after+mt_srand%28%29%3A+'
         39        INIT_FCALL                                                   'var_export'
         40        BEGIN_SILENCE                                        ~17     
         41        INIT_FCALL                                                   'lcg_value'
         42        DO_FCALL_BY_NAME                                             
         43        END_SILENCE                                                  ~17
         44        IS_IDENTICAL                                         ~19     !0, $18
         45        SEND_VAL                                                     ~19
         46        SEND_VAL                                                     <true>
         47        DO_ICALL                                             $20     
         48        ECHO                                                         $20
         49        ECHO                                                         '%0A'
   13    50        INIT_FCALL                                                   'srand'
         51        SEND_VAL                                                     42
         52        DO_ICALL                                                     
   14    53        BEGIN_SILENCE                                        ~22     
         54        INIT_FCALL                                                   'lcg_value'
         55        DO_FCALL_BY_NAME                                             
         56        END_SILENCE                                                  ~22
         57        ASSIGN                                                       !0, $23
   15    58        INIT_FCALL                                                   'srand'
         59        SEND_VAL                                                     42
         60        DO_ICALL                                                     
   16    61        ECHO                                                         'lcg_value+repeats+after+srand%28%29%3A+'
         62        INIT_FCALL                                                   'var_export'
         63        BEGIN_SILENCE                                        ~26     
         64        INIT_FCALL                                                   'lcg_value'
         65        DO_FCALL_BY_NAME                                             
         66        END_SILENCE                                                  ~26
         67        IS_IDENTICAL                                         ~28     !0, $27
         68        SEND_VAL                                                     ~28
         69        SEND_VAL                                                     <true>
         70        DO_ICALL                                             $29     
         71        ECHO                                                         $29
         72        ECHO                                                         '%0A'
         73      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
130.6 ms | 497 KiB | 15 Q