YouTube-operational-API
YouTube-operational-API copied to clipboard
Use `===` instead of `==` to be more precise
Is there any similar rule? Make sure not to break anything by doing so.
So should proceed to #24 first.
By the way what is the rule in PHP to choose between quotes ' and "? Cf https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax. As a result should change liveChats.php. This Stack Overflow answer answers it quite well. I should use " à la printf instead of concatenating variables with ..
grep -r '"' --exclude-dir=.git/
I guess var and !var mean respectively var != false and var != true, and not var !== false and var !== true (which aren't equivalent to var === true and var === false, cf file_get_contents return value and the commit associated to this issue).
As:
<?php
$a = 'test';
if(!$a) {
echo 'one';
}
if($a != false) {
echo 'two';
}
if($a) {
echo 'three';
}
?>
echos twothree, my guess was wrong and !$a is interpreted as $a !== false, while $a is interpreted as $a == true.
As boolean conditions can come up quite everywhere, I should proceed to full code review while thi king about this issue.
Following vim command helps a lot:
:%s/old/new/gc
Still have " in index.php while they should be '.