Discussion:
Could you have a OOP methodology access to array
Vitold S
2014-09-03 10:12:06 UTC
Permalink
Hello,

Do u know about planning or implementing OOP methdology access to array
methods in PHP in future. Like show code later:

$a = new Array();
$a->append("hello");
$a->shift();
$p = $a->pop();

$b = Array::fill(fill_char="*", count=20)
$b->pop()

Also how about syntetic Map object from Java?

Thanks.
Jim Lucas
2014-09-03 15:58:20 UTC
Permalink
Post by Vitold S
Hello,
Do u know about planning or implementing OOP methdology access to array
$a = new Array();
$a->append("hello");
$a->shift();
$p = $a->pop();
$b = Array::fill(fill_char="*", count=20)
$b->pop()
Also how about syntetic Map object from Java?
Thanks.
Do you mean this?

http://php.net/manual/en/class.arrayobject.php
--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
David Harkness
2014-09-03 18:00:34 UTC
Permalink
Post by Jim Lucas
Post by Vitold S
$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
Christoph Becker
2014-09-03 21:36:44 UTC
Permalink
Post by Vitold S
Do u know about planning or implementing OOP methdology access to array
$a = new Array();
$a->append("hello");
$a->shift();
$p = $a->pop();
$b = Array::fill(fill_char="*", count=20)
$b->pop()
See
<http://nikic.github.io/2014/03/14/Methods-on-primitive-types-in-PHP.html>.
--
Christoph M. Becker
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...