Re: Type hints revisited [IllegalArgumentException instead of E_ERROR]
| From: | Brian Moon | Date: | Thu, 27 Mar 2003 17:45:21 +0000 |
| Subject: | Re: Type hints revisited [IllegalArgumentException instead of E_ERROR] | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-379@lists.php.net to get a copy of this message | ||
Ok, sorry, I have been off the ZE2 list for a while (just joined back).
Where is there more info on what the type hints do in ZE2. I am curious as
I wrote the RFC.
Brian.
dealnews
----- Original Message -----
From: "Timm Friebe" <thekid@thekid.de>
To: "Brian Moon" <brianm@dealnews.com>
Cc: <engine2@lists.zend.com>; <internals@lists.php.net>
Sent: Thursday, March 27, 2003 11:40 AM
Subject: Re: [PHP-DEV] Type hints revisited [IllegalArgumentException
instead of E_ERROR]
| On Thu, 2003-03-27 at 18:32, Brian Moon wrote:
| > Has type hinting for functions been implemented in ZE2?
|
| Type hints apply to global functions just as they do for class methods.
|
| <?php
| class Date {
| private
| $utime = 0;
|
| public function __construct($arg= -1) {
| if (is_int($arg)) {
| $this->utime= $arg < 0 ? time() : $arg;
| } else {
| $this->utime= strtotime($arg);
| }
| }
|
| public function toString($fmt= 'r') {
| return date($fmt, $this->utime);
| }
| }
|
| function print_date(Date $date, $fmt) {
| echo $date->toString($fmt);
| }
|
| print_date(new Date(), $argv[1]);
| echo "\n";
| ?>
| thekid@friebes:~/devel/php > ./php5/sapi/cli/php date.php "Y-m-d"
| 2003-03-27
|
| - Timm
|
|
| --
| PHP Internals - PHP Runtime Development Mailing List
| To unsubscribe, visit: http://www.php.net/unsub.php
|
|
|