3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generateRandomString($length = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyz-_.'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } $unique = array(); for ($i = 0; $i < 9000000; $i++) { $u=$i+1; $random = generateRandomString(5); if(!in_array($random, $unique)){ echo $u.".m".$random."@[server]\n"; $unique[] = $random; gc_collect_cycles(); }else{ echo "duplicate detected"; $i--; } } echo memory_get_peak_usage();

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 3
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 24
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 3
Branch analysis from position: 29
Branch analysis from position: 3
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 3
Branch analysis from position: 29
Branch analysis from position: 3
filename:       /in/AtTkO
function name:  (null)
number of ops:  33
compiled vars:  !0 = $unique, !1 = $i, !2 = $u, !3 = $random
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->27
   15     3    >   ADD                                              ~6      !1, 1
          4        ASSIGN                                                   !2, ~6
   16     5        INIT_FCALL                                               'generaterandomstring'
          6        SEND_VAL                                                 5
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                                   !3, $8
   17     9        INIT_FCALL                                               'in_array'
         10        SEND_VAR                                                 !3
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $10     
         13        BOOL_NOT                                         ~11     $10
         14      > JMPZ                                                     ~11, ->24
   18    15    >   CONCAT                                           ~12     !2, '.m'
         16        CONCAT                                           ~13     ~12, !3
         17        CONCAT                                           ~14     ~13, '%40%5Bserver%5D%0A'
         18        ECHO                                                     ~14
   19    19        ASSIGN_DIM                                               !0
         20        OP_DATA                                                  !3
   20    21        INIT_FCALL                                               'gc_collect_cycles'
         22        DO_ICALL                                                 
   17    23      > JMP                                                      ->26
   22    24    >   ECHO                                                     'duplicate+detected'
   23    25        PRE_DEC                                                  !1
   13    26    >   PRE_INC                                                  !1
         27    >   IS_SMALLER                                               !1, 9000000
         28      > JMPNZ                                                    ~19, ->3
   27    29    >   INIT_FCALL                                               'memory_get_peak_usage'
         30        DO_ICALL                                         $20     
         31        ECHO                                                     $20
         32      > RETURN                                                   1

Function generaterandomstring:
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 = 17, Position 2 = 7
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
Branch analysis from position: 7
filename:       /in/AtTkO
function name:  generateRandomString
number of ops:  19
compiled vars:  !0 = $length, !1 = $characters, !2 = $charactersLength, !3 = $randomString, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      10
    3     1        ASSIGN                                                   !1, '0123456789abcdefghijklmnopqrstuvwxyz-_.'
    4     2        STRLEN                                           ~6      !1
          3        ASSIGN                                                   !2, ~6
    5     4        ASSIGN                                                   !3, ''
    6     5        ASSIGN                                                   !4, 0
          6      > JMP                                                      ->15
    7     7    >   INIT_FCALL                                               'rand'
          8        SEND_VAL                                                 0
          9        SUB                                              ~10     !2, 1
         10        SEND_VAL                                                 ~10
         11        DO_ICALL                                         $11     
         12        FETCH_DIM_R                                      ~12     !1, $11
         13        ASSIGN_OP                                     8          !3, ~12
    6    14        PRE_INC                                                  !4
         15    >   IS_SMALLER                                               !4, !0
         16      > JMPNZ                                                    ~15, ->7
    9    17    > > RETURN                                                   !3
   10    18*     > RETURN                                                   null

End of function generaterandomstring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.19 ms | 1008 KiB | 18 Q