|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-02-23 14:34 UTC] tyrael@php.net
-PHP Version: 6SVN-2010-04-19 (snap)
+PHP Version: Irrelevant
[2020-10-23 12:42 UTC] cmb@php.net
-Status: Open
+Status: Suspended
[2020-10-23 12:42 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 16:00:01 2025 UTC |
Description: ------------ To make PHP more object-oriented it would be useful to give primitives (Strings especially, as they have a large number of related functions) a more OO interface. In the same way PHP5 introduced ArrayObject, it would be useful to create a StringObject in PHP6. E.g. example usage: <?php //Some example usage $str = 'Foo'; echo $str->toLower(); echo $str->replace('Foo', 'Bar'); echo $str->replace('Foo', 'Bar')->toLower(); //ideally needs inbuilt support for chaining echo $str; //could be done using __toString() ?> This can be achieved at the moment by defining a StringObject class and using $str = new String('My String'); or similar. However, the usefulness is limited because there's no way to automatically wrap all strings within the application.