Req #51598 [Opn->Sus]: String Objects?
| From: | cmb@php.net | Date: | Fri, 23 Oct 2020 12:42:44 +0000 |
| Subject: | Req #51598 [Opn->Sus]: String Objects? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229868@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=51598&edit=1
ID: 51598
Updated by: cmb@php.net
Reported by: tom at r dot je
Summary: String Objects?
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: Strings related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
This feature request needed to be discussed, for what this bug
tracker is unsuitable. So if you're still interested in this
feature, please forward the request to the internals mailing
list[1]. For the time being, I'm suspending this ticket.
[1] <https://www.php.net/mailing-lists.php#internals>
Previous Comments:
------------------------------------------------------------------------
[2010-04-19 11:05:34] tom at r dot je
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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=51598&edit=1