1.Date

<?php

$date = date('m-d-y');
$time = date('H:i:s');
$day = date('l');

echo ' the time is ' .$time;

?>

2.Explode

<?php

$sentence = 'I am zxl this is my php tutorial';
$parts = explode(' ',$sentence); //分割字符串

print_r($parts);

?>



3.Find If String Contains a String(1)

<?php

$sentence = 'I am zxl this is my php tutorial';
$needle = 'z';

$search = strpos($sentence , $needle);

if ($search === FALES )
{
echo 'the string was not found';
}
else
{
echo 'the position of the string is ' . $search ;
}

?>



Find If String Contains a String(2)

<?php

$email = 'zxl@gmail.com';
$needle = '@';

$search = strpos($email , $needle);

if ($search === FALES )
{
echo 'this is not a valid email';
}
else
{
echo 'this is a valid email' ;
}

?>