PHP-তে র্যান্ডম স্ট্রিং জেনারেট করার কোড নিচে দেওয়া হলো:
উদাহরণ
<?php $res = substr(md5(mt_rand()), 0,5); echo "Displaying random string...\n"; echo $res; ?>
আউটপুট
এটি নিচের আউটপুটটি দেবে:
Displaying random string... 1c856
উদাহরণ
আরেকটি উদাহরণ দেখা যাক:
<?php $res = substr(md5(mt_rand()), 0,5); echo "Displaying random string...\n"; echo $res; echo "\nDisplaying another random string...\n"; $res2 = bin2hex(random_bytes(5)); echo $res2; ?>
আউটপুট
এটি নিচের আউটপুটটি দেবে:
Displaying random string... a3541 Displaying another random string... 335b83d9e9