Tags

, , , , , ,

Object to array convert in php

For e.g
Array
(
[0] => stdClass Object
(
[user_id] => 10
)

[1] => stdClass Object
(
[user_id] => 20
)
)

Convert into array

Array
(
[0] => 10

[1] => 20
)

$array = json_decode(json_encode($object),true);

Advertisements