Ok, i am a relatively new programmer and spend way to much time umming and ahhing over different ways to write certain code.
Can anyone please say whether there is any fundamental difference between the following and if any should be preferred over the other:
if (empty($array)) {
//must be an empty array
}
if (true === empty($array)) {
//must be an empty array
}
if (is_array($array) && count($array) === 0) {
//must be an empty array
}
Sorry if this seems trivial but no joke, this stuff takes up a lot of my time deciding and ultimately at some level there has to be a difference in either correctness, robustness or performance (or a combination)