If $var = "Chicago, IL", and I want $var2 just to be "Chicago", this is what I do now:
Code: Select all
$var = "Chicago, IL";
$vartemp = explode(",", $var, 2);
$var2 = $vartemp[0];Any ideas?
Thanks!
Moderator: General Moderators
Code: Select all
$var = "Chicago, IL";
$vartemp = explode(",", $var, 2);
$var2 = $vartemp[0];Code: Select all
$var = thisFunction("Chicago, IL");
function thisFunction($text)
{
$vartemp = explode(",", $text, 2);
return = $vartemp[0];
}