How do I clean up this if/else statement? (refactoring)
if-statement, php, refactoring
Solution
What is wrong with the original code?
<?php
if (empty($row[ContactName])
&& empty($row[ContactEmail])
&& empty($row[ContactPhone])
&& empty($row[Website]))
{
echo "Not Provided";
}
else{
...do stuff...
}
?>
Looks like fine code to me...
Problem
I know there must be a nicer way to do this, but whenever I search "&&" i don't get good enough results... ``` <?php if (empty($row[ContactName]) && empty($row[ContactEmail]) && empty($row[ContactPhone]) && empty($row[Website])){ echo "Not Provided"; } else{ ...do stuff... } ?> ``` Thanks!