note 60509 deleted from function.strval by sobak
| From: | sobak@php.net | Date: | Thu, 01 Dec 2016 18:02:01 +0000 |
| Subject: | note 60509 deleted from function.strval by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207916@lists.php.net to get a copy of this message | ||
Note Submitter: anthony dot parsons at manx dot net
----
If you have to compare object variables like this be careful not to make a typo, or you could end up
calling __set() -
<?php
/* Does what you'd expect it to */
if ( $user->password == $user2->password )
/* Doesn't */
if ( $user->password = $user2->password )
?>
To avoid that ever happening, do it like this:
<?php
if ( strval($user->password) == $user2->password )
?>