Re: Summary of string conversion problem

From: Date: Mon, 01 Dec 2003 18:53:12 +0000
Subject: Re: Summary of string conversion problem
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-5930@lists.php.net to get a copy of this message
I'm not really sure on what's the best way to handle the string conversion problem, as I haven't worked with SimpleXML yet. Andi's examples on the other hand aren't convincing enough for me so here my comments: Andi Gutmans wrote:
a) include $obj; will not error out but convert the object to a string and then include it.
I'd expect that in most cases this would be an invalid filename which would result in an error message. Nothing lost there.
b) $obj[2] = 3; (where $obj implements a __toString function) isn't quite defined anymore. Should this work?
The bracket syntax has been deprecated in PHP4 already. Giving a warning on a high error reporting level seems do the job for me.
c) $arr[$obj] would suddenly work according the __toString().
I remember this being requested as a feature anyway ;-)
go and the way Java chose too (not that I thnk we necessarily need to go the same way but there were some smart ppl who thought of these issues before us).
I don't like Java being used for PHP design decisions really. The syntax is cumbersome and has a different focus (static type checking). Don't forget that a lot of design decisions for Java were made in the 80s. My $.2, - Chris

« previous php.internals (#5930) next »