Re: New Package SPL_Types
| From: | Andi Gutmans | Date: | Sat, 04 Mar 2006 15:20:28 +0000 |
| Subject: | Re: New Package SPL_Types | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-3574@lists.php.net to get a copy of this message | ||
Does this require any engine changes or is it purely internal user-land?
Andi
At 04:46 AM 3/4/2006, Marcus Boerger wrote:
Hello guys, i'd like to add a new package called 'SPL_Types' that adds enum support to PHP and might later on add stuff closely related to 'AutoBoxing' (actually that is a side effect/a trash product of it). Example: class Weekday extends SplEnum { const Sunnday = 0; const Monday = 1; const Tuesday = 2; const Wednesday = 3; const Thursday = 4; const Friday = 5; const Saturday = 6; const __default = Weekday::Sunday; } $e = new Weekday; var_dump($e); // shows object of type SplEnum var_dump((int)$e); // int(0) $e++; var_dump($e); // shows object of type SplEnum var_dump((int)$e); // int(1) var_dump($e + 3); // int(4) Anyone pro/contra? Best regards, Marcus -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php