note 42865 deleted from function.array-search by aidan
| From: | aidan@php.net | Date: | Sat, 16 Oct 2004 01:08:40 +0000 |
| Subject: | note 42865 deleted from function.array-search by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78634@lists.php.net to get a copy of this message | ||
Note Submitter: jackylee at eml dot cc
----
<?php
// is not a complete code but useful when change the format of filename
// hope this can save your time :-)
// old filename : 10Apr2004.txt
$year = substr($file, -8, 4);
$month = substr($file, -11, 3);
$M = array("01" => "Jan", "02" => "Feb",
"03" => "Mar", "04" => "Apr", "05" =>
"May", "06" => "Jun",
"07" => "Jul", "08" => "Aug",
"09" => "Sep", "10" => "Oct", "11" =>
"Nov", "12" => "Dec");
$month = array_search($month, $M); // returns the corresponding key if successful
$newfile = "$year$month.php";
// new filename will be : 200404.php
?>