Re: Could you have a OOP methodology access to array

From: Date: Wed, 03 Sep 2014 18:00:34 +0000
Subject: Re: Could you have a OOP methodology access to array
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-323812@lists.php.net to get a copy of this message
On Wed, Sep 3, 2014 at 8:58 AM, Jim Lucas <lists@cmsws.com> wrote: > On 09/03/2014 03:12 AM, Vitold S wrote: > >> $a = new Array(); >> $a->append("hello"); >> $a->shift(); >> $p = $a->pop(); >> >> $b = Array::fill(fill_char="*", count=20) >> $b->pop() >> > > Do you mean this? > > http://php.net/manual/en/class.arrayobject.php ArrayObject implements only a handful of the array functions. It misses most of the array_* functions such as array_keys, array_fill, array_intersect, etc. Since the underlying array is stored in a private field, you'd either need to create your own class or use reflection in a subclass (ick) to add these other features. Cheers, David

« previous php.general (#323812) next »