Checking strpos - PHP's idea of BPD

Suppose you need to make sure that a certain path does not contain a certain string.

1. strpos($CurrentPath,'node/12345/') < 0
Will not fire because the return value is FALSE.

2. strpos($CurrentPath,'node/12345/') == FALSE
Will fire even when the path starts with the string because a return value of 0 evaluates to FALSE.

3. !(strpos($CurrentPath,'node/12345/') > -1)
Finally!

Comments