3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.5 ms | 1395 KiB | 17 Q