In PHP, is there a way to simplify this even more, without using an if()?
$foo = $bar!==0 ? $foo : '';
I was wondering if there was a way to not reassign $foo to itself if the condition is satisfied. I understand there is a way to do this in Javascript (using &&, right?), but was wondering if there was a way to do this in PHP.
Yup, you can use the logical and (
&&) operator in PHP as well.