I noticed that most of my posts and projects have been quite centered around C# and application development instead of PHP and web development. To tell you the truth, I’m a little afraid of releasing my PHP code. Trust me, I write in true PHP 5 – very class oriented, none of this HTML intertwined between PHP code bull. It’s more that I want the code to be perfect before I release it. Starting now, I’ll try to share some useful functions I wrote that might help you on your quest to developing a PHP website.
Today, I’ll show you a quick function that converts time in words to seconds. Well, let’s say you are using memcached and you want to save an item for X seconds. It may be simple to put 60 for a minute or 3600 for a hour, but larger than that gets complex and not so easy to reverse (129600 is a day and a half). This function converts simple terms like “1d 6h” or “2h 24m 15s” to their seconds counterpart.