I am trying to execute some function that will find (in the next array) an object with identifier 2 and move it to the beginning of the array. Here's the original array:
Array ( [0] => stdClass Object ( [id] => 177 [startdate] => 2014-08-02 ) [1] => stdClass Object ( [id] => 178 [startdate] => 2014-08-02 ) [2] => stdClass Object ( [id] => 2 [startdate] => 2014-07-28 ) [3] => stdClass Object ( [id] => 82 [startdate] => 2014-07-28 ) [4] => stdClass Object ( [id] => 199 [startdate] => 2013-10-10 ) )
And here is what I would like to output (with the array element moved):
Array ( [0] => stdClass Object ( [id] => 2 [startdate] => 2014-07-28 ) [1] => stdClass Object ( [id] => 177 [startdate] => 2014-08-02 ) [2] => stdClass Object ( [id] => 178 [startdate] => 2014-08-02 ) [3] => stdClass Object ( [id] => 82 [startdate] => 2014-07-28 ) [4] => stdClass Object ( [id] => 199 [startdate] => 2013-10-10 ) )
Any help would be appreciated.
source share