i have this string -
$result = "ABCDE";
and i want to seperate them to 3 parts
(like part 1 = A, part 2 = B, part 3 = C..., part 5 = E)
,give a name to each of them
part 1(A) = Apple
part 2(B) = Orange
part 3(C) = Ice-cream
part 3(D) = Water
part 5(E) = Cow
then the finally output is like
Output : You choose Apple, Orange, Ice-cream, Water, Cow
or like this
$result = "ACE";
Output : You choose Apple, Ice-cream, Cow
i have tried using array
$result = "ABCDE";
$showing = array(A => 'Apple , ', B => 'Orange , ', C => 'Ice-cream , ',
D => 'Water , ', E => 'Cow , ');
echo $showing[$result];
but i got nothing while output, seems array is not working in fixed string.
i want to know how to do it
ABCDEset in the$showingarray, so it doesn't show anything. You'll want to take the$resultstring apart into individual characters and output all the array elements that intersect with this array (hint hint cougharray_intersectcough).