ID:               49957
 User updated by:  greg at imagiclab dot com
 Reported By:      greg at imagiclab dot com
 Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: unix
 PHP Version:      5.3.0
 New Comment:

Ok i see you point but other are not as complex like

__toResource would be create for connect on demand db classes


you can also only have the magic methods for float and int called if
you 
are specifically cast like (int)$Object


Previous Comments:
------------------------------------------------------------------------

[2009-10-23 10:24:21] johan...@php.net

This was discussed and leads to too many unclear situations. Like
should  $a + $b call toFloat or toInt or what? What about $a < $b? Maybe
a string comparison.

In the end implementing this gives more trouble than where it helps.

------------------------------------------------------------------------

[2009-10-22 15:23:46] greg at imagiclab dot com

Description:
------------
Need magic method for every data type.

Why have a incomplete magic method list. Why not a __toInt and 
__toResource.

We are trying to change a legacy system to connect to mysql on demand 
and would love a __toResource magic method.  

Also anyone who uses class based enums would like a __toInt to convert

the enum to is int valyue and to use __toSting to convert the enum to 
its label.

Reproduce code:
---------------
---
>From manual page: language.oop5.magic
---




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49957&edit=1

Reply via email to