3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * This code will benchmark your server to determine how high of a cost you can * afford. You want to set the highest cost that you can without slowing down * you server too much. 10 is a good baseline, and more is good if your servers * are fast enough. */ $timeTarget = 0.2; $cost = 9; do { $cost++; $start = microtime(true); password_hash("test", PASSWORD_BCRYPT, ["cost" => $cost]); $end = microtime(true); } 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 = 20, Position 2 = 2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
filename:       /in/B703p
function name:  (null)
number of ops:  24
compiled vars:  !0 = $timeTarget, !1 = $cost, !2 = $start, !3 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 0.2
   10     1        ASSIGN                                                   !1, 9
   12     2    >   PRE_INC                                                  !1
   13     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
   14     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                                                 
   15    13        INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $11     
         16        ASSIGN                                                   !3, $11
   16    17        SUB                                              ~13     !3, !2
         18        IS_SMALLER                                               ~13, !0
         19      > JMPNZ                                                    ~14, ->2
   18    20    >   CONCAT                                           ~15     'Appropriate+Cost+Found%3A+', !1
         21        CONCAT                                           ~16     ~15, '%0A'
         22        ECHO                                                     ~16
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.62 ms | 1395 KiB | 17 Q