$arr = array(‘Business – zoom’,’Company – Innovation’,’Emp – Salary’);
$newArr = array();
foreach($arr as $std):
$temp = explode(‘-‘,$std);
$newArr [] = trim($temp[0]);
endforeach;
print_r($newArr);

Result:

Array ([0] => Business [1] => Company [2] => Emp)

 

Your Answer
Sign In
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.