note 13527 added to function.strpos.php

From: Date: Wed, 20 Jun 2001 14:47:09 +0000
Subject: note 13527 added to function.strpos.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-14492@lists.php.net to get a copy of this message
Note the following: The === or !== operators do have a higher precedence than == or != operators. This can harm you in the case, that if you write sth like if ( $pos=strpos($hugo,'/') !== false ) ... This dosn't work, PHP evals this like in the following order: if ( $pos= ( strpos($hugo,'/') !== false ) ) ... which means, that $pos is at the end either true or false (which is not what you in most cases wanted - I think :-). So the correct writing for this is if ( ( $pos=strpos($hugo,'/') ) !== false ) ... http://php.fidion.de/manual/en/function.strpos.php

« previous php.notes (#14492) next »