I have an array called:
$fragment = array($fragment);
Which has the following three values:
["<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Please enter a title <\/div>"]["<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Enter a valid source URL (e.g. http:\/\/en.wikipedia.org\/wiki\/Penguins) <\/div>"]["<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Please choose a category <\/div>"]
I want to merge that array into another array (into the 'fragment' key) which looks like:
$toReturn = array(
'status' => $status,
'formData' => $formData,
'inputs' => $inputs,
'fragment' => $fragment
);
But every time I do so, it just adds the first value of $fragment which is:
"<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Please enter a title <\/div>"
How can I add all three values from $fragment into my $toReturn array instead?
You can create one long string with the three array entries by concatenating them, e.g. with the popular
implodeDocs function: