|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51598 String Objects?
Submitted: 2010-04-19 11:05 UTC Modified: 2013-02-23 14:34 UTC
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:1 (25.0%)
From: tom at r dot je Assigned:
Status: Open Package: Strings related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tom at r dot je
New email:
PHP Version: OS:


 [2010-04-19 11:05 UTC] tom at r dot je
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 

In the same way PHP5 introduced ArrayObject, it would be useful to create a 
StringObject in PHP6.

E.g. example usage:

//Some example usage
$str = 'Foo';
echo $str->toLower();
echo $str->replace('Foo', 'Bar');
echo $str->replace('Foo', 'Bar')->toLower(); //ideally needs inbuilt support for 
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-23 14:34 UTC]
-PHP Version: 6SVN-2010-04-19 (snap) +PHP Version: Irrelevant
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jul 08 08:01:26 2020 UTC