#49957 [Opn->Bgs]: Need magic method for every data type

From: Date: Fri, 23 Oct 2009 10:24:22 +0000
Subject: #49957 [Opn->Bgs]: Need magic method for every data type
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-143830@lists.php.net to get a copy of this message
 ID:               49957
 Updated by:       johannes@php.net
 Reported By:      greg at imagiclab dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: unix
 PHP Version:      5.3.0
 New Comment:

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.


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

[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



Thread (4 messages)

« previous php.bugs (#143830) next »