A little bit of everything…
RSS icon Home icon
  • Two methods for generating random strings and passwords

    phpMany websites and boards, upon registration, send the new users an e-mail with their user name and a random password. This is just one of the many purposes for which generating a random string or password is useful.

    Ever wondered how this is done? Actually, with PHP, it’s very easy. I will explain you two ways of doing so, and provide the necessary code for you to have the script up and running immediately; you may use the one which suits your needs most. Of course, those are not the only ways to achieve the same goal, but are very effective and in the same time, easy to understand. Note that in this post, the random string will be used as password.

    Read the rest of this entry »

  • PHP: converting string into formatted date

    While coding I came across the following situation: a date which was showed with the format YYYY-MM-DD, but I wanted its format to be DD-MM-YYYY.

    Obviously there’s the PHP Date function, you will think, but the point here is that the initial date was a variable as string. Therefore using directly the date function did not work…luckily it is not difficult to find out how to get the desired results.

    Read the rest of this entry »