<?php
Top Most important Php function
1. empty(); // return true false
$p='val';
if(!empty($p)){ // if $p is not empty
echo 'variable is not empty ';
} else {
echo 'value is null';
}
2. unset();
use for unse session or variable values
unset($a);
3. isset();
if(isset($a)){
echo 'value is set ';
} else {
echo 'value is not set ';
}
4. trim()
use for removes the whitespaces from the left part of the string.
trim($a);
5. explode () ;
convert strin to array
$str = "Rajeev Dhar dwivedi";
$array = explode(" ",$str);
print_r($array);
outPut :
Array ( [0] => Rajeev [1] => Dhar [2] => dwivedi )
6. implode();
convert array to string
$array = array( 'Rajeev' ,'Dhar','Dwived') ;
echo implode(" ",$array);
Output :
Rajeev Dhar Dwived
7. date() function
this function use fot get date from system
echo date('Y-M-d');
8. time()
this function use for get time from system in mili second
echo time();
9. strip_tags();
use for remove html tags
example :
$tag="<b><p>rajeev</p></b>";
echo strip_tags($tag); // output : rajeev
No comments:
Post a Comment