Number and String comparison in PHP (Numeric Values VS String Values)
<?php
if(0 == 'Cat')
{
echo 1;
}
// outputs 1
if(0.1 > 'Cat')
{
echo 1;
}
// outputs 1
# strings are converted into 0 when strings are compared (using '==' operator) with numeric values
?>
if(0 == 'Cat')
{
echo 1;
}
// outputs 1
if(0.1 > 'Cat')
{
echo 1;
}
// outputs 1
# strings are converted into 0 when strings are compared (using '==' operator) with numeric values
?>
Comments
Post a Comment