Posts Tagged ‘Comparison Operators’

Know the Difference Between Comparison Operators

This is a good tip, but it is missing a practical example that demonstrates when a non-strict comparison can cause problems. If you use strpos() to determine whether a substring exists within a string (it returns FALSE if the substring is not found), the results can be misleading: <?php $authors = ‘Vijay & Jana’; if (strpos($authors, ‘Vijay’)) [...]