I\'m building a website that contains users with user profiles. Many of the fields in the profile are optional.
There is an opportunity for a lot of user-generate
I'd go with:
if( empty($names['display_name']) ) {
$name = $names['first_name'] . ' ' $names['last_name'];
else
$name = $names['display_name'];
$name = trim($name);
if( empty($name) )
$name = 'user'.$names['id'];
if( empty($name) )
$name = 'NULL';
This would be the 'core logic'... there will need to be other checks like $names != NULL or something..