Generating random string token may sound like a trivial work. If you really want something “truly random”, it is one difficult job to do. In a project where you want a not so critical scrambled string there are many ways to get it done. I present eight different ways of getting a random string token using PHP. Using random_int() Using rand() By string shuffling to generate a random substring. Using bin2hex() Using mt_rand() Using hashing sha1() Using hashing md5() Using PHP uniqid() There are too many PHP functions that can be used to generate the random string. With the combination of those functions, this code assures to generate an unrepeatable random string and unpredictable by a civilian user. 1) Using random_int() The PHP random_int() function generates cryptographic pseudo random integer. This random integer is used as an index to get the character from the given string base. The string base includes 0-9, a-z and ...
Software Training institute in erode, Mullamparappu. Java, Blockchain, Machine Learning, Meanstack, Artifical Intelligence, Kotlin, Cloud Computing, Angular, React, IOT, DevOps, PHP, .Net, Big Data and Hadoop, Spark, Data Analytics, R Programming, SEO and Digital Marketing, Android, Python, Oracle, Web Designing, Spring, Hibernate, Software Testing, Seleninum, Linux, C and C++ Python , Ethical Hacking and many more technologies.