Merge pull request #673 from likemusic/patch-1

Update The-Basics.md
This commit is contained in:
Phil Sturgeon
2016-07-17 14:37:21 +01:00
committed by GitHub

View File

@@ -20,15 +20,12 @@ var_dump($a == '5'); // compare value (ignore type); return true
var_dump($a === 5); // compare type/value (integer vs. integer); return true var_dump($a === 5); // compare type/value (integer vs. integer); return true
var_dump($a === '5'); // compare type/value (integer vs. string); return false var_dump($a === '5'); // compare type/value (integer vs. string); return false
/** //Equality comparisons
* Strict comparisons
*/
if (strpos('testing', 'test')) { // 'test' is found at position 0, which is interpreted as the boolean 'false' if (strpos('testing', 'test')) { // 'test' is found at position 0, which is interpreted as the boolean 'false'
// code... // code...
} }
// vs. // vs. strict comparisons
if (strpos('testing', 'test') !== false) { // true, as strict comparison was made (0 !== false) if (strpos('testing', 'test') !== false) { // true, as strict comparison was made (0 !== false)
// code... // code...
} }