2
I have the following line of code:
$valores = implode(", ", array_values($dados));
and, by giving a var_dump(array($valores));
the following information is returned:
array(1) { [0]=> string(26) "Igor, Test, [email protected]" }
However, I need every comma to return each item in a new array (in this case, an array with 3 items).
That is, create an array of that other array($valores)
.
What’s the best way to do that?
EDITED
I’ve tried using the explode
:
$arrValores = array($valores);
$itemValores = explode(", ", $arrValores);
foreach($itemValores as $item) {
$item;
}
var_dump($item);
But what is returned to me is:
string(5) "Array"
Thank you!
Or just not using the
implode
, only thearray_values
.– Guilherme Nascimento
Yes, @Sergio. I edited the question.
– Igor
@Igor and not use
implode
?????????– Guilherme Nascimento
That’s right, @Guilhermenascimento. I have to use the
implode
, turns out, I was just creating another variable responsible forarray_values
only, and I hadn’t even thought about it. Thank you for clearing my mind!– Igor