Welcome! Log In Create A New Profile

Advanced

Parse error: PHP 3 - 10. Logical Operators

Posted by Shado77968239 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
avatar Parse error: PHP 3 - 10. Logical Operators
February 24, 2013 07:16PM
I'm working through logical operators and came across an error on the last bit.

The example is:
Language: PHP
$test_value = false; if ($test_value = = false) { print(!$test_value); }

This gives me an error (Parse error: syntax error, unexpected '=' in /variables.php on line 11). Now according to the error the problem is with this line:
Language: PHP
if ($test_value = = false) {

Now as I understand the logic - if the answer is true the browser will print a "1" on the page, if the answer is false it will print nothing to the page.

So why is this code wrong?

____________________________________________Nazi Coder____________________________________________

I'm not antisocial, I'm just not user friendly

"It's not a bug; it's an undocumented feature!" ~ some unknown Microsoft developer
avatar Re: Parse error: PHP 3 - 10. Logical Operators
February 24, 2013 07:29PM
Ok - this should be one of those lessons one should fall back on when ever your script just is not working.

After spending sometime reading up I was able to deduce that the error was as a result of a typo, line 11 should be as follows:

Language: PHP
if ($test_value == false) {

So if all else fails check your typing smile

I have to wonder whether this was done as a test to see if we are actually running the examples.

____________________________________________Nazi Coder____________________________________________

I'm not antisocial, I'm just not user friendly

"It's not a bug; it's an undocumented feature!" ~ some unknown Microsoft developer
avatar
Mac
Re: Parse error: PHP 3 - 10. Logical Operators
February 25, 2013 07:52AM
Yes, there is no space between the equal signs.
Sorry, only registered users may post in this forum.

Click here to login