View Single Post
  #4 (permalink)  
Old Apr 19th, 2007, 03:25
grahame grahame is offline
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: There has to be an easier way

Quote:
Originally Posted by Donny Bahama View Post
Is there a better way of doing this? Something short and much more efficient? Seems like every time I do something like this, there's always a way to do it in just a line or two of code...
Yes, the general rule in PHP is that if you find yourself repeating something common, there has to be an easier way. How about

Code: Select all
<?php
$inval = "09";

$tsample = mktime(12,0,0,$inval,15,2007);
$mname = date("F",$tsample);

print ("It is the month of $mname");
?>
which uses the already-provided tables of month names within the date function ...
Reply With Quote