<?php
$date = DateTime::createFromFormat(‘j-M-Y’, ’17-May-2012′);
echo $date->format(‘Y-m-d’);
?>
Output
2012-05-17
<?php
$date = DateTime::createFromFormat(‘j-M-Y’, ’17-May-2012′);
echo $date->format(‘Y-m-d’);
?>
Output
2012-05-17
Example
<?php
$date = date_create_from_format(‘j-M-Y’, ’17-May-2012′);
echo date_format($date, ‘Y-m-d’);
?>
Output
2012-05-17
We can add number of of days, months, years, hours and seconds with a DateTime object.
Example
Output
2012-05-05
Example
<?php
$date = new DateTime(“24-May-2011 20:15:22”);
echo $date->format(“d-m-Y H:i:s”).'<br />’;
date_add($date, new DateInterval(“P1Y”));
echo ‘<br />’.$date->format(“d-m-Y”).’ : I Year’;
?>
Output
24-05-2011 20:15:22
24-05-2012 : I Year
It checks whether the date is valid or not
General Format :checkdate ( int $month , int $day , int $year )
Example :
<?php
if(checkdate(12, 31, 2000))
echo “Given Date Is Correct”;
?>
Output
Given Date Is Correct
<?php echo rand(1, 10) ?>
We can find out the position using the function strpos() that will return the position of a character
Example
<?php
$string=”phpcodez.com”;
echo strpos($string,”.”) // 8
?>
Its a flag and if its value is set to one we must use the longer version of the variable
Array Name | Longer version of the name |
$_POST | $HTTP_POST_VARS |
$_FILES | $HTTP_POST_FILES |
$_GET | $HTTP_GET_VARS |
$_COOKIE | $HTTP_COOKIE_VARS |
$_ENV | $HTTP_ENV_VARS |
$_SERVER | $HTTP_SERVER_VARS |
$_SESSION | $HTTP_SESSION_VARS |
Its not at all a convenient option , so its always better to have the value set to off
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world’s writing systems. Developed in conjunction with the Universal Character Set standard and published in book form as The Unicode Standard, the latest version of Unicode consists of a repertoire of more than 109,000 characters covering 93 scripts, a set of code charts for visual reference, an encoding methodology and set of standard character encodings, an enumeration of character properties such as upper and lower case, a set of reference data computer files, and a number of related items, such as character properties, rules for normalization, decomposition, collation, rendering, and bidirectional display order
Unicode can be implemented by different character encodings. The most commonly used encodings are UTF-8, the now-obsolete UCS-2, and UTF-16. UTF-8 uses one byte for any ASCII characters, which have the same code values in both UTF-8 and ASCII encoding, and up to four bytes for other characters. UCS-2 uses two bytes for each character but cannot encode every character in the current Unicode standard. UTF-16 extends UCS-2, using four bytes to handle each of the additional characters.