I'm trying to retrieve the object which has the lowest distance value from an array of objects. This is my data set below;
[0] => myObjectThing Object
(
[name:myObjectThing:private] => asadasd
[distance:myObjectThinge:private] => 0.9826368952306
)
[1] => myObjectThing Object
(
[name:myObjectThing:private] => 214gerwert24
[distance:myObjectThinge:private] => 1.5212312547306
)
[2] => myObjectThing Object
(
[name:myObjectThing:private] => abc123
[distance:myObjectThinge:private] => 0.0000368952306
)
So I'd like to be able to retieve the object which has the smallest distance value. In this case it would be object with name: abc123
** EDIT ** What would happen if I only used arrays, e.g.
array(
array('name' => 'bla', 'distance' => '123');
array('name' => 'b123a', 'distance' => '1234214');
);
Would this be easier to find the min value?
distancevalue? The answers below are only returning the first encountered min. On other pages on Stack Overflow, an array of results is populated.