Function 1 : array_rand
Get a random variable in an array.
$sites = array ("google.com","Bing", "yahoo.com", "php.net", "apple.com"); $k = array_rand($sites); echo $sites[$k];
Function 2: strip_tags
Get rid of HTML tags in paragraph. Mostly use in CMS
$message = "This is my bio"; echo strip_tags($message); // "This is my bio"
Function 3: strftime
This function change type of date, time as we want
1strftime("%B %d, %Y", time()); // January 28, 2014
Function 4: basename
Get only a file name.
$path = "/some/long/path/to/the/special_file.txt"; $filename1 = basename($path); // special_file.txt $filename2 = basename($path, ".txt"); // special_file
Function 5: list
Re-assign variable in an array
$array = ["arjun", "Anaparthi"]; list($first-name, $last-name) = $array; echo $first-name; // Arjun echo $last-name; // Anaparthi
Function 6: range
Create an array which contains characters or numbers
range(100, 110); // array(100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 10) range('g', 'l'); // array('g', 'h', 'i', 'j', 'k'. 'l');
Function 7: isset
The most common and useful funciton to check variable existed or not.
$name = "arjun"; isset($name); // return true isset($age); // return false
Function 8: array_key_exit
check for array key in the array
$array = array(100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 10); if(array_key_exit('',$array)) { do something... }