Flatten Array Using Index


/ Published in: PHP
Save to your folder(s)

Before:
`
Array
(
[0] => Array
(
[total_sessions] => 24
[study_type_id] => 1
)

[1] => Array
(
[total_sessions] => 24
[study_type_id] => 2
)

[2] => Array
(
[total_sessions] => 20
[study_type_id] => 3
)

[3] => Array
(
[total_sessions] => 10
[study_type_id] => 4
)

[4] => Array
(
[total_sessions] => 10
[study_type_id] => 5
)

[5] => Array
(
[total_sessions] => 10
[study_type_id] => 6
)

[6] => Array
(
[total_sessions] => 10
[study_type_id] => 7
)

[7] => Array
(
[total_sessions] => 8
[study_type_id] => 10
)

[8] => Array
(
[total_sessions] => 8
[study_type_id] => 12
)

)
`
After:
`
Array
(
[1] => Array
(
[total_sessions] => 24
)

[2] => Array
(
[total_sessions] => 24
)

[3] => Array
(
[total_sessions] => 20
)

[4] => Array
(
[total_sessions] => 10
)

[5] => Array
(
[total_sessions] => 10
)

[6] => Array
(
[total_sessions] => 10
)

[7] => Array
(
[total_sessions] => 10
)

[10] => Array
(
[total_sessions] => 8
)

[12] => Array
(
[total_sessions] => 8
)
)
`

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.