3v4l.org

run code in 300+ PHP versions simultaneously
<?php $timeTarget = 0.2; $cost = 9; do { $cost++; $start = microtime(true); password_hash("test", PASSWORD_BCRYPT, ["cost" => $cost]); $end = microtime(true); var_dump([$cost, $end-$start]); } while (($end - $start) < $timeTarget); echo "Appropriate Cost Found: " . $cost . "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
filename:       /in/7RItJ
function name:  (null)
number of ops:  30
compiled vars:  !0 = $timeTarget, !1 = $cost, !2 = $start, !3 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0.2
    5     1        ASSIGN                                                   !1, 9
    7     2    >   PRE_INC                                                  !1
    8     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
    9     7        INIT_FCALL                                               'password_hash'
          8        SEND_VAL                                                 'test'
          9        SEND_VAL                                                 '2y'
         10        INIT_ARRAY                                       ~9      !1, 'cost'
         11        SEND_VAL                                                 ~9
         12        DO_ICALL                                                 
   10    13        INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $11     
         16        ASSIGN                                                   !3, $11
   11    17        INIT_FCALL                                               'var_dump'
         18        INIT_ARRAY                                       ~13     !1
         19        SUB                                              ~14     !3, !2
         20        ADD_ARRAY_ELEMENT                                ~13     ~14
         21        SEND_VAL                                                 ~13
         22        DO_ICALL                                                 
   12    23        SUB                                              ~16     !3, !2
         24        IS_SMALLER                                               ~16, !0
         25      > JMPNZ                                                    ~17, ->2
   14    26    >   CONCAT                                           ~18     'Appropriate+Cost+Found%3A+', !1
         27        CONCAT                                           ~19     ~18, '%0A'
         28        ECHO                                                     ~19
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.02 ms | 1395 KiB | 19 Q