note 93109 added to control-structures.if
| From: | php dot net at bgr8 dot com | Date: | Mon, 24 Aug 2009 04:17:03 +0000 |
| Subject: | note 93109 added to control-structures.if | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159821@lists.php.net to get a copy of this message | ||
an interesting concept, using only double == ... but i'm executing php from the command line on
an ubuntu server using php5 ... and if i use ==, the function fails, but if i use = the function
works.
i try it with good and bad value pairs echoing "match" to the screen when they match (the
executed line) and "match" will not happen with ==. only with =. neither one tosses an
error, but the == NEVER shows a match and the = matches when the two strings being compared actually
match. this is not something i was expecting after programming in several languages.
go figure.
#!/usr/bin/php
<?php
if ($check = $output)
echo "match\n";
?>
obviously there's code to make them match or not match, but that code does not change. i JUST
add/remove an = and the code works with =.
----
Server IP: 208.69.120.35
Probable Submitter: 173.171.70.22
----
Manual Page -- http://www.php.net/manual/en/control-structures.if.php
Edit -- https://master.php.net/note/edit/93109
Del: integrated -- https://master.php.net/note/delete/93109/integrated
Del: useless -- https://master.php.net/note/delete/93109/useless
Del: bad code -- https://master.php.net/note/delete/93109/bad+code
Del: spam -- https://master.php.net/note/delete/93109/spam
Del: non-english -- https://master.php.net/note/delete/93109/non-english
Del: in docs -- https://master.php.net/note/delete/93109/in+docs
Del: other reasons-- https://master.php.net/note/delete/93109
Reject -- https://master.php.net/note/reject/93109
Search -- https://master.php.net/manage/user-notes.php