5 ms·
Yeah, but what about // $set $foo to $bar $foo == $bar; // print out value of $foo echo $foo; // is $bar the same as $foo? if so, r
by da_n 14y ago
Yeah, but what about
// $set $foo to $bar
$foo == $bar;
// print out value of $foo
echo $foo;
// is $bar the same as $foo? if so, return true, otherwise return false
if ( $bar === $foo ) { // check if the same
return true; // great, it's true!
} else { // here we check if it isn't true
return false; // nope, not true, let's return false
}
I have nothing against comments where something needs to be documented, but not everything needs comments as most code is essentially self-documenting.
Edited for clarity.
- andreasvc 14y agoIt's completely uncontroversial that those comments are unnecessary. When you see them you remove them; no reason not to write any comments at all.
- sethetter 14y agoI expected it to be a given that these kinds of comments are unnecessary. It's better to comment on the "why" than the "how" or "what". Comments are useful when they help explain a piece of code's integration into the rest of the system. Why is it there in the first place?