Change array format in PHP.
Posted
by Muhammad Sajid
on Stack Overflow
See other posts from Stack Overflow
or by Muhammad Sajid
Published on 2010-03-30T11:52:45Z
Indexed on
2010/03/30
12:13 UTC
Read the original article
Hit count: 373
I have an array like:
Array
(
[6] => Array
(
[quantity] => 23
[orgId] => 6
[validity] => 20
)
[2] => Array
(
[quantity] => 5
[orgId] => 2
[validity] => 2
)
[5] => Array
(
[quantity] => 5
[orgId] => 5
[validity] => 4
)
[4] => Array
(
[quantity] => 7
[orgId] => 4
[validity] => 10
)
)
and i want to show that like this:
Array
(
[0] => Array
(
[quantity] => 23
[orgId] => 6
[validity] => 20
)
[1] => Array
(
[quantity] => 5
[orgId] => 2
[validity] => 2
)
[2] => Array
(
[quantity] => 5
[orgId] => 5
[validity] => 4
)
[3] => Array
(
[quantity] => 7
[orgId] => 4
[validity] => 10
)
)
To do that i used array_push & some other technique but fail. can someone help me thanks.
© Stack Overflow or respective owner