php array echo if statement -


i have following php echo:

<?php echo $tag->title; ?> 

it pulls 4 multiple items, i.e.

a b c d

i add if stateement above code that:

if - echo or

if b - echo b or

if c - echo c or

if d - echo nothing

if string in 1 a b c d, can explode them

$exp = explode(" ", $tag->title);  if(in_array("a", $exp)) echo "a"; if(in_array("b", $exp)) echo "b"; if(in_array("c", $exp)) echo "c"; if(in_array("d", $exp)) echo "nothing";