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;
}
```

-- 
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to