3v4l.org

run code in 300+ PHP versions simultaneously
<?php function startsWith($haystack, $needle) { return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE; } function find_dec_prefix($str) { $i = 0; for(;;$i++) { if ($i == 0) $newstr = $str; else $newstr = $str . $i; $hash = sha1($newstr); if($hash[0] == '0' && $hash[1] == 'e') { // echo "Found it: [" . $newstr . "] " . $hash . "\n"; // echo "subs: " . substr($hash, 2) . "\n"; if(!preg_match("/[a-f]/", substr($hash, 2))) { echo "doesn't contain a-f: $hash\n"; return $newstr; } } } } $pass1 = find_dec_prefix("aaroZmOk"); $pass2 = find_dec_prefix("aaK1STfY"); var_dump(sha1($pass1) == sha1($pass2)); echo(sha1('aaroZmOk') . " == " . sha1('aaK1STfY') . "\n"); $pass3 = find_dec_prefix("suPERSecretPasSw0rD"); $pass4 = find_dec_prefix("omgDONTcollidePLEASE"); var_dump(sha1($pass3) == sha1($pass4)); echo(sha1('aaroZmOk') . " == " . sha1('aaK1STfY') . "\n");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8JYip
function name:  (null)
number of ops:  57
compiled vars:  !0 = $pass1, !1 = $pass2, !2 = $pass3, !3 = $pass4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'find_dec_prefix'
          1        SEND_VAL                                                 'aaroZmOk'
          2        DO_FCALL                                      0  $4      
          3        ASSIGN                                                   !0, $4
   25     4        INIT_FCALL                                               'find_dec_prefix'
          5        SEND_VAL                                                 'aaK1STfY'
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !1, $6
   27     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'sha1'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $8      
         12        INIT_FCALL                                               'sha1'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $9      
         15        IS_EQUAL                                         ~10     $8, $9
         16        SEND_VAL                                                 ~10
         17        DO_ICALL                                                 
   28    18        INIT_FCALL                                               'sha1'
         19        SEND_VAL                                                 'aaroZmOk'
         20        DO_ICALL                                         $12     
         21        CONCAT                                           ~13     $12, '+%3D%3D+'
         22        INIT_FCALL                                               'sha1'
         23        SEND_VAL                                                 'aaK1STfY'
         24        DO_ICALL                                         $14     
         25        CONCAT                                           ~15     ~13, $14
         26        CONCAT                                           ~16     ~15, '%0A'
         27        ECHO                                                     ~16
   30    28        INIT_FCALL                                               'find_dec_prefix'
         29        SEND_VAL                                                 'suPERSecretPasSw0rD'
         30        DO_FCALL                                      0  $17     
         31        ASSIGN                                                   !2, $17
   31    32        INIT_FCALL                                               'find_dec_prefix'
         33        SEND_VAL                                                 'omgDONTcollidePLEASE'
         34        DO_FCALL                                      0  $19     
         35        ASSIGN                                                   !3, $19
   33    36        INIT_FCALL                                               'var_dump'
         37        INIT_FCALL                                               'sha1'
         38        SEND_VAR                                                 !2
         39        DO_ICALL                                         $21     
         40        INIT_FCALL                                               'sha1'
         41        SEND_VAR                                                 !3
         42        DO_ICALL                                         $22     
         43        IS_EQUAL                                         ~23     $21, $22
         44        SEND_VAL                                                 ~23
         45        DO_ICALL                                                 
   34    46        INIT_FCALL                                               'sha1'
         47        SEND_VAL                                                 'aaroZmOk'
         48        DO_ICALL                                         $25     
         49        CONCAT                                           ~26     $25, '+%3D%3D+'
         50        INIT_FCALL                                               'sha1'
         51        SEND_VAL                                                 'aaK1STfY'
         52        DO_ICALL                                         $27     
         53        CONCAT                                           ~28     ~26, $27
         54        CONCAT                                           ~29     ~28, '%0A'
         55        ECHO                                                     ~29
         56      > RETURN                                                   1

Function startswith:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/8JYip
function name:  startsWith
number of ops:  15
compiled vars:  !0 = $haystack, !1 = $needle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        IS_IDENTICAL                                     ~2      !1, ''
          3      > JMPNZ_EX                                         ~2      ~2, ->13
          4    >   INIT_FCALL                                               'strrpos'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        STRLEN                                           ~3      !0
          8        MUL                                              ~4      ~3, -1
          9        SEND_VAL                                                 ~4
         10        DO_ICALL                                         $5      
         11        TYPE_CHECK                                  1018  ~6      $5
         12        BOOL                                             ~2      ~6
         13    > > RETURN                                                   ~2
    4    14*     > RETURN                                                   null

End of function startswith

Function find_dec_prefix:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 3
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 35
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 35
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 3
Branch analysis from position: 37
Branch analysis from position: 3
Branch analysis from position: 35
Branch analysis from position: 19
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
Branch analysis from position: 19
filename:       /in/8JYip
function name:  find_dec_prefix
number of ops:  38
compiled vars:  !0 = $str, !1 = $i, !2 = $newstr, !3 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, 0
    7     2      > JMP                                                      ->36
    8     3    >   IS_EQUAL                                                 !1, 0
          4      > JMPZ                                                     ~5, ->7
    9     5    >   ASSIGN                                                   !2, !0
          6      > JMP                                                      ->9
   11     7    >   CONCAT                                           ~7      !0, !1
          8        ASSIGN                                                   !2, ~7
   12     9    >   INIT_FCALL                                               'sha1'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !3, $9
   13    13        FETCH_DIM_R                                      ~11     !3, 0
         14        IS_EQUAL                                         ~12     ~11, '0'
         15      > JMPZ_EX                                          ~12     ~12, ->19
         16    >   FETCH_DIM_R                                      ~13     !3, 1
         17        IS_EQUAL                                         ~14     ~13, 'e'
         18        BOOL                                             ~12     ~14
         19    > > JMPZ                                                     ~12, ->35
   16    20    >   INIT_FCALL                                               'preg_match'
         21        SEND_VAL                                                 '%2F%5Ba-f%5D%2F'
         22        INIT_FCALL                                               'substr'
         23        SEND_VAR                                                 !3
         24        SEND_VAL                                                 2
         25        DO_ICALL                                         $15     
         26        SEND_VAR                                                 $15
         27        DO_ICALL                                         $16     
         28        BOOL_NOT                                         ~17     $16
         29      > JMPZ                                                     ~17, ->35
   17    30    >   ROPE_INIT                                     3  ~19     'doesn%27t+contain+a-f%3A+'
         31        ROPE_ADD                                      1  ~19     ~19, !3
         32        ROPE_END                                      2  ~18     ~19, '%0A'
         33        ECHO                                                     ~18
   18    34      > RETURN                                                   !2
    7    35    >   PRE_INC                                                  !1
         36    > > JMPNZ                                                    <true>, ->3
   22    37    > > RETURN                                                   null

End of function find_dec_prefix

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.81 ms | 1407 KiB | 27 Q