Friday 12 July 2019

Is there any difference between "and" and "&&" operators in PHP?

I have the following code and don't think and is needed, i.e. && should be used, as there is nothing to assign the left part to?



if($_REQUEST['foo'] != 'abc' and $_REQUEST['bar'] == 'def')
{
echo "all your base";
}


So it should be:




if($_REQUEST['foo'] != 'abc' && $_REQUEST['bar'] == 'def')
{
echo "all your base";
}

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...