Generate Random String in PHP

Method 1: Using substr() with str_shuffle()

HOuLUcgSPftdTa74DAz35YGlhyvkBn0w

Method 2: Using bin2hex() with random_bytes()

6c73fa051defa46b87d4a52509a90e39

Method 3: Using bin2hex() with openssl_random_pseudo_bytes()

8607b02252d13952b69a69ee4489056e

Method 4: Using rand() with sha1() hashing

8801688bd7955da48da5dd8f59ca9276

Method 5: Using custom random characters

YdIfwoU9wmGfheBsABbalzmvUcSrQ11V