Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
$arr = array('id', 2, 'product', 3);
$new = array();
for ($i = 0; $i < count($arr) - 1; $i += 2) {
$new[$arr[$i]] = $arr[$i + 1];
}
var_dump($new);
in the first case, you have the result of the array formation, and in the second, the array formation string.
It's like asking "how to make (2 + 3) out of 5?"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question