[web-php] PR #836: - php 8.3 release page example code fix
| From: | kamilpiech97 | Date: | Thu, 23 Nov 2023 20:00:33 +0000 |
| Subject: | [web-php] PR #836: - php 8.3 release page example code fix | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-31096@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/web-php/pull/836
Author: kamilpiech97
In that [section](https://www.php.net/releases/8.3/en.php#randomizer_get_bytes_from_string) about
php 8.3 release, I found mistake in example of code and I fixed them.
Before PR:
```
function getBytesFromString(string $string, int $length) {
$stringLength = strlen($string);
$result = '';
for ($i = 0; $i < $length; $i++) {
// random_int is not seedable for testing, but secure.
$result .= $string[random_int(0, $stringLength - 1)]);
}
return $result;
}
```
After PR:
```
function getBytesFromString(string $string, int $length) {
$stringLength = strlen($string);
$result = '';
for ($i = 0; $i < $length; $i++) {
// random_int is not seedable for testing, but secure.
$result .= $string[random_int(0, $stringLength - 1)];
}
return $result;
}
```