3v4l.org

run code in 300+ PHP versions simultaneously
<?php class HashCracker { private $range = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; private $length = 32; private $cycles = 1000; public function runBenchmark($hash, $prefix = '') { foreach ($this->range as $key) { $match = $prefix . $key; $times[$match] = microtime(true); for ($i = 0; $i < $this->cycles; $i += 1) { strcmp($hash, $match); } $times[$match] = microtime(true) - $times[$match]; } asort($times); var_dump($times, reset($times)); } } $password = 'hello'; $hashed = md5($password); var_dump('Hash to match: ' . $hashed); (new HashCracker())->runBenchmark($hashed);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DV6Q6
function name:  (null)
number of ops:  15
compiled vars:  !0 = $password, !1 = $hashed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ASSIGN                                                   !0, 'hello'
   29     1        INIT_FCALL                                               'md5'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   31     5        INIT_FCALL                                               'var_dump'
          6        CONCAT                                           ~5      'Hash+to+match%3A+', !1
          7        SEND_VAL                                                 ~5
          8        DO_ICALL                                                 
   33     9        NEW                                              $7      'HashCracker'
         10        DO_FCALL                                      0          
         11        INIT_METHOD_CALL                                         $7, 'runBenchmark'
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
         14      > RETURN                                                   1

Class HashCracker:
Function runbenchmark:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 30
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 30
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 14
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 14
Branch analysis from position: 22
Branch analysis from position: 14
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/DV6Q6
function name:  runBenchmark
number of ops:  42
compiled vars:  !0 = $hash, !1 = $prefix, !2 = $key, !3 = $match, !4 = $times, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
   11     2        FETCH_OBJ_R                                      ~6      'range'
          3      > FE_RESET_R                                       $7      ~6, ->30
          4    > > FE_FETCH_R                                               $7, !2, ->30
   12     5    >   CONCAT                                           ~8      !1, !2
          6        ASSIGN                                                   !3, ~8
   13     7        INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $11     
         10        ASSIGN_DIM                                               !4, !3
         11        OP_DATA                                                  $11
   15    12        ASSIGN                                                   !5, 0
         13      > JMP                                                      ->19
   16    14    >   INIT_FCALL                                               'strcmp'
         15        SEND_VAR                                                 !0
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
   15    18        ASSIGN_OP                                     1          !5, 1
         19    >   FETCH_OBJ_R                                      ~15     'cycles'
         20        IS_SMALLER                                               !5, ~15
         21      > JMPNZ                                                    ~16, ->14
   19    22    >   INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $18     
         25        FETCH_DIM_R                                      ~19     !4, !3
         26        SUB                                              ~20     $18, ~19
         27        ASSIGN_DIM                                               !4, !3
         28        OP_DATA                                                  ~20
   11    29      > JMP                                                      ->4
         30    >   FE_FREE                                                  $7
   22    31        INIT_FCALL                                               'asort'
         32        SEND_REF                                                 !4
         33        DO_ICALL                                                 
   24    34        INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !4
         36        INIT_FCALL                                               'reset'
         37        SEND_REF                                                 !4
         38        DO_ICALL                                         $22     
         39        SEND_VAR                                                 $22
         40        DO_ICALL                                                 
   25    41      > RETURN                                                   null

End of function runbenchmark

End of class HashCracker.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.74 ms | 1400 KiB | 25 Q