On Fri, 2008-01-04 at 10:59 -0800, Stanislav Malyshev wrote: > > Not necessarily, if you have a function that performs a generic > > operation on any object. As for resources you are right, it might be > > Like what? I don't know many operations that are good for any object and > only object and need special function to perform them. Actually, > excluding scenarios like serialization and RPC (which should take care > of other types too so irrelevant here) I can't think of any right now. > > ideal to have "mysql resource" rather than just "resource", but just > > having the "resource" type hint is better than having no type hint. > > No, it's not better. Having GD image instead of mysql connection is not > better than having integer in any way. It would just produce different > error message, so what?
That's actually very true. > > This is one that I find very useful, much more than it may seem. I use > > scalar for any type of post/get input, printed output, or DB > > interaction, as objects/arrays/resources cannot be printed or stored in > > a database in a standardized way. > > If you need serialization/printing, you have serialize() and > __toString() with respective handlers. If you reimplementing them and > using scalar restrictions, you most probably do it wrong. Ok but if someone inputs an array in the query string i have a problem with that. And I said standardized way, ie bool true outputs as "1", float 5.20 outputs as "5.2". For objects, toString is a standardized output but serialization is not, and for arrays no standardized output exists. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php