From:             
Operating system: 
PHP version:      6SVN-2010-04-19 (snap)
Package:          Strings related
Bug Type:         Feature/Change Request
Bug description:String Objects?

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 bug report at http://bugs.php.net/bug.php?id=51598&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51598&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51598&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51598&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51598&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51598&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51598&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51598&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51598&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51598&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51598&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51598&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51598&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51598&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51598&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51598&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51598&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51598&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51598&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51598&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51598&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51598&r=mysqlcfg

Reply via email to