php native functions like min() do not support fixed arrays -


i wondering why native php function min($array) not support spl fixed arrays. okay gettype object, still contains array data.

there many useful php functions arrays, in order use them have use method $fx_array->toarray(). whenever decide use fixed arrays have think.. need use toarray()?

as splfixedarray implements iterator, easy extend class itself:

class splfixedarrayonsteroids extends splfixedarray {    public function min(){      $min = $this[0];      foreach($this $value)     {        if($value < $min)         $min = $value;      }      return $min;    }  } 

ok know less portable , all, welcome php.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -