Hallo zusammen,
ich bekomme bei folgendem Code immer die Fehlermeldung: Parse error: syntax error, unexpected '$cost' (T_VARIABLE) in [...] on line 6:
PHP
<?php
$timeTarget = 1;
$cost = 9;
do {
$cost++;
$start = microtime(true);
password_hash("test", PASSWORD_DEFAULT, ["cost" => $cost]);
$end = microtime(true);
} while (($end - $start) < $timeTarget);
echo "Appropriate Cost Found: " . $cost . "\n";
?>
Alles anzeigen
Wo liegt das Problem? Ich sehe nichts...
Schon mal danke für eure Hilfe.
Gruß
JR Cologne
Edit: Habe mal Folgendes ausprobiert:
Fehlermeldung: Parse error: syntax error, unexpected ''test'' (T_CONSTANT_ENCAPSED_STRING) in [...] on line 4
Edit 2:
Und noch eine höchst verwirrende Fehlermeldung:
Fehler: Parse error: syntax error, unexpected ' while ' (T_STRING), expecting while (T_WHILE) in [...] on line 5
Edit 3:
Ok, jetzt wird's echt gruselig. Plötzlich funktioniert es einfach.
Gut, scheint sich dann von selbst erledigt zu haben...