im having a list of names james,steve,manson,charles in a array and im using the explode function to separate them.
$pieces = explode(",", $full);
foreach ($pieces as $p ){
$piece[]=$p;
}
the problem that im having is that i can access the variables as
$piece[0];
$piece[1];
but the order differs time to time based on the input therefore i cant do a comparison. can someone suggest how to set the values so i can do the comparison as below
if ($piece==='manson'){
//do something;
}else{
//do something
}
if ($piece==='steve'){
//do something;
}else{
//do something
}
switch?