I have three variables that may or may not contain data.
let’s call them $name, $address and $telephone.
Let’s say I want to combine them all into one var, $contact, each on a separate line.
$contact = $name.'<br />'.$address.'<br />'.$telephone;
$contact then gets put into an array. That array eventually goes through a foreach loop, not handling any vars that are equal to ''. How do I tell if the string is empty other than the two <br /> tags? I’ve tried copying $contact to $test_contact and running str_replace('<br />', '', $test_contact; but even when all the vars have been set to '' $test_contact == '' still evaluates to false. I’ve also tried trim() after str_replace() but that doesn’t seen to work either. I’ve also tried using === but again, no luck.
What am I missing? Is there a better way to do this?
Mark
check before inserting:
if ($name.$address.$telephone == '')then is empty