PHP Random string generation help required

by 13 replies
15
hello people

I am new to php and I just wonder I want combination of random number and random string, how can I generate it using php?

Any help regarding this is highly appreciated.
#programming #generation #php #random #required #string
  • You can use rand function of php to generate random number and you can take part of the session_id to generate random string , if you combine both of them it will give you required result
  • @bug thank you for your help but if you dont mind can you give me an example of what you have explain in php code?

    Thanks in advance
    • [1] reply
    • Ok here is a simple code for you.

      PHP Code:
      session_start();
      echo  
      substr(session_id(),1,8).rand(); 
      • [ 1 ] Thanks
      • [1] reply
  • For some reason I'm not able to put this in full.

    Check out this link: http://stackoverflow.com/a/853898

    Pretty cool answer.
    • [1] reply
    • This is a nice find. Truely a unique way of generating random stuffs. Thanks for the share.
      • [1] reply
  • You can geenrate very good random string by session and md5 combination

    You can use both the function together and get good string
  • Hello

    You can use uniqid(); to randomly ganerate numbers/string
  • This might help you to generate PHP password. You can download the script if required.
    PHP Password Generator
  • [DELETED]

Next Topics on Trending Feed