PHP, do not display variable if false.?

/-=GT=-\

New member
I have two variables.

$type = 'Search Engine';
$title = 'Yahoo' . $type;
Output, Yahoo Search Engine

What I'd like to do is to set $type = 0;
and then verify $type in $title = 'Yahoo' . $type to see if $type is true or false.

0=false.. If it's false, I want title to be.

$title = 'Yahoo' . $other;

Thanks in advance.
 
I'm not sure exactly what you're trying to accomplish so I don't know if this will answer your question or not, but from what I got you should use arrays.

// Set the info
$info = array('type' => 'Search Engine', 'title' => 'Yahoo');
// See if type exists, if not then set it to $other
if (!$info['type']) $info['type'] = $other;
// Implode the array into a single string
//seperating type and title by a space
$title = implode(' ', $info);
 
Back
Top