How many maximum characters can be in the $string
variable?
$string = 'test';
echo md5($string);
Thank you in advance for your answers.
How many maximum characters can be in the $string
variable?
$string = 'test';
echo md5($string);
Thank you in advance for your answers.
A md5 is always 32 characters long, i think you can limit it
Note: As of PHP 7.0.0, there are no particular restrictions regarding the length of a string on 64-bit builds. On 32-bit builds and in earlier versions, a string can be as large as up to 2GB (2147483647 bytes maximum)
If you need to calculate MD5 hashes of huge strings, perhaps you want to use files so you can save memory and calculate the hash with md5_file().
I've made a quick test with a 527 GB disk image (PHP/7.4 x64 on Windows 10). It was painfully slow (in my case the bottleneck was the file being on a slow disk) but the script had a peak memory usage of 2 MB.