Can you write the following in one line of code?
$foo = explode(":", $foo); $foo = $foo[0];
you could use stristr for this:
$foo = stristr($foo,":",true);
where true sets it to give you everything before the first instance of ":"