Handy functions in php

by Guna 2012-07-22 09:55:48

Hi,

Following are some of the useful functions in php.

basename:
You can use this function to get file name from a path. for ex:


$abs_path="/home/sekar/local/myfile.txt";
$file=basename($abs_path);
echo $file; //myfile.txt


list:
This function exports array items as variables, have a look at this example:


list($name,$age)=array("sekar",25);
echo $name; //sekar
echo $age; //25


strftime:
This function will convert timestamp in any format you'd like, for ex:


echo strftime("%B %d, %Y", time()); // July 22, 2012

Tagged in:

884
like
0
dislike
0
mail
flag

You must LOGIN to add comments