Comparison:
In PHP the boolean values TRUE and FALSE are case in-sensitive.
Example:
$a=TrUe;
if($a)
echo 'Entered'; //will come
if($a==TRUE)
echo 'Entered'; //will come
if($a===TRUE)
echo 'Entered'; //will come
And TRUE = Something other than FALSE or 0 or '0'.
Example:
$a='test';
$b='0';
if($a==TRUE)
echo 'Entered'; //will come
if($b==TRUE)
echo 'Entered'; //will not come
Increment Operator:
If we use an increment operator along with a string, it will increment last letter of the string(When the last letter of the string is alpha numeric, that is other than special characters).
Example:
$a='apple3';
$b='apple';
$c='apple?';
echo ++$a; // output: apple4
echo ++$b; // output: applf
echo ++$c; // output: apple?
Case Sensitive:
In PHP variables are case sensitive but functions are not.
Example:
$test='red';
echo $tesT; // will not work
sample(); // will work
function Sample()
{
echo 'inside function';
}
Please go throw the following links for more details:
http://www.sitepoint.com/3-strange-php-facts-you-may-not-know/
http://php.net/manual/en/types.comparisons.php
In PHP the boolean values TRUE and FALSE are case in-sensitive.
Example:
$a=TrUe;
if($a)
echo 'Entered'; //will come
if($a==TRUE)
echo 'Entered'; //will come
if($a===TRUE)
echo 'Entered'; //will come
And TRUE = Something other than FALSE or 0 or '0'.
Example:
$a='test';
$b='0';
if($a==TRUE)
echo 'Entered'; //will come
if($b==TRUE)
echo 'Entered'; //will not come
Increment Operator:
If we use an increment operator along with a string, it will increment last letter of the string(When the last letter of the string is alpha numeric, that is other than special characters).
Example:
$a='apple3';
$b='apple';
$c='apple?';
echo ++$a; // output: apple4
echo ++$b; // output: applf
echo ++$c; // output: apple?
Case Sensitive:
In PHP variables are case sensitive but functions are not.
Example:
$test='red';
echo $tesT; // will not work
sample(); // will work
function Sample()
{
echo 'inside function';
}
Please go throw the following links for more details:
http://www.sitepoint.com/3-strange-php-facts-you-may-not-know/
http://php.net/manual/en/types.comparisons.php
No comments:
Post a Comment