I am trying to format my array into something like this: name is John, age is 30
. Here is my sample array and code:
$user = array(
'name' => 'John',
'age' => 35
);
echo key($user)." is ".($user[key($user)]).","; // prints "name is John,"
The comma (,)
will be gone if there’s no more results to be printed out.
I am bad at logic but can you help me for this? It will be a great help! Thanks in advance.
2
Answers
Or