php | Search in array -
Do I have an array and search the object with a maximum rating? Array ([0] = & gt; stdClass object ([created_by] => 905 [ratings] => 1) [1] => stdClass object resembles the following:
< Pre> ([Created_by] => 906 [Ratings] = & gt; 2))
Thanks!
I have tried to do something like this:
stable work maxValueInArray ($ array, $ keyToSearch) {$ currentMax = NULL; Forex currency ($ sir as $ arr) {foreach ($ arr $ $ key = & gt; $ value) {if ($ key == $ keyToSearch & amp; ($ value & gt; = $ currentMax) $ $ CurrentMax = $ value; }}} Return $ CurrentMax; }
Since your array has not been sorted (I think), you All values will need to be read.
$ maxobject = null; Foreign currency ($ line as $ line) if (is_null ($ maxobject) $$ maxobject-> rating & lt; $ row- & gt; rating) $ maxobject = $ row;
Comments
Post a Comment