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
Post a Comment