PHP always helps us to create something new always. Today we are going to create a new function name as Random code generator using php. Random code generator is mainly a program which is helps to create random code in every time. It helps you to create a different code for session or confirmation code. Let’s see how we can create this function. We are going to this code using php. First we create a function rand_code() and put some code for this function. But here is a tricks, we can create our random code with using any length. For that we will pass a veriabel for that. In this fact our function will rand_code($length). We pass length as our wish then this function will run random code a spacific length which is provide by us. Our function is
This is our function, we can customize this function as our requirment. $min_lenght and $max_lenght variables are helps us to excute minimum and maximus start point of random code. We can config this before using as our requirment. When we run this function with lenght like
<?php echo rand_code(10); ?>
Then this function will execute different code in every time. We can use this code for set user session, send verifiction code using this code. I hope this code is helpfull for us.