With the help of an example i would explain a very common but erroneous approach new php developers seem to follow (i have seen some ‘old’ ones repeating the same error though). Here it is, Continue reading
Tag Archives: php how to
ArchiveA few tips on writing php code that can save a php developer a lot of future troubles and “huffs and puffs” occurring due to different php compiler settings, changing of hosting environment etc. Here is first one. Continue reading
While working with a CJ run reports script i needed to convert “month name” into “month number” so i could store it in the database in date format. After doing some cleaning stuff i was ending with the month name, a three character string as “Jan”,”Mar”,”Apr” etc. Here is the quick work around i applied to get the month number automatically from the month name.
$month_name = "Jan"; //which i get from file name (Range_from_1_Jan_2009_to_3_Mar_2009.txt)
$month_number = "";
for($i=1;$i<=12;$i++){
if(strtolower(date("M", mktime(0, 0, 0, $i, 1, 0))) == strtolower($month_name)){
$month_number = $i;
break;
}
}
Now as php snippet code line 5 date(“M”, mktime(0, 0, 0, 1, 1, 0))) returns a three letter represantion of month name i get month “1″ if i pass $month_name=”Jan” and so on. If i had full month name like “January” i could make it work by replacing “M” with “F” where “F” format parameter is a full represantion of year name.
Special Note: Do not forget to see user comments down the page to find even smarter solutions

Recent Comments
Arvind Thakur on Simple image rotater with fadeIn fadeOut effect using jQuery
Found even more-more precised and simplest method at Jonathan Snook's blog with a demo. I am sure nothing can be...anil kiumar on Resume download of PART extension file in Firefox
yah bepsait acchi haiArvind Thakur on Simple captcha component for CakePHP 1.x
CakePHP 2.x version of this component is hereArvind Thakur on Resume download of PART extension file in Firefox
As i did not had access to website i tried to reply you last night through email address you posted...sophia on Resume download of PART extension file in Firefox
Hi, I have only part file and I made a copy of it by removing .part. later I moved it to another...