On 24/09/12 20:04, Andrew Faulds wrote:
On 24/09/12 15:41, Ivan Enderlin @ Hoa wrote:
Recently, I crafted a String object that support most of the
propositions written here. Please, see
https://github.com/hoaproject/String (file String.php). The code is
very simple (it implies that it do not need a lot of work to
implement it in PHP I hope). Some interesting methods:
• append;
• prepend;
• pad;
• getIterator (equivalent of str_split);
• \ArrayAccess methods (with support of out-of-bound indexes);
• getByteAt (with support of out-of-bound indexes);
• getCharDirection;
• fromCode;
• toCode.
I would love such a library to be built into PHP. A more consistent
approach to scalar operations would be great. "hello,
world"->replace('world', 'php'); would be so much nicer than
str_replace and forgetting the argument order. This is a little
off-topic, though.
Yup, it is off-topic. We can add new functions in one hand and
“autoboxing” scalars into OOP style in another hand.
--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/
PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/
Member of HTML and WebApps Working Group of W3C
http://w3.org/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php