php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45898 Implement a string class
Submitted: 2008-08-23 13:28 UTC Modified: 2008-08-25 08:13 UTC
From: j dot stutterheim at hccnet dot nl Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 6CVS-2008-08-23 (CVS) OS: OS X 10.5.4
Private report: No CVE-ID: None
 [2008-08-23 13:28 UTC] j dot stutterheim at hccnet dot nl
Description:
------------
Adding a string class to PHP would be greatly appreciated. It would 
allow for direct operations on a string:

<?php
$helloWorld = 'Hello World';

// Assign string 'Hello' to $hello
$hello = $helloWorld->subString(0, 5);
?>

Of course it would support a whole lot more string operations. See C# 
or Java as reference for example.
It should also be compatible with the current string functions. PHP 6 
would be a nice target for this feature.

If for some reason it's not possible to combine this with the current 
approach, consider looking at Objective-C's solution. It requires an @ 
to be appended before the string, so it becomes a NSString instead of  
a regular C string.







Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-23 18:46 UTC] tularis@php.net
This has been discussed on the internals list before, and the support for it seems to be minimal at best. You can read the last discussion about it on this thread:
http://marc.info/?l=php-internals&m=119673254908065&w=2
 [2008-08-23 18:47 UTC] tularis@php.net
If you need more info about this, ask on the internals list.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 14:01:30 2024 UTC