Re: Type hints revisited [IllegalArgumentException instead of E_ERROR]

From: Date: Thu, 27 Mar 2003 17:40:26 +0000
Subject: Re: Type hints revisited [IllegalArgumentException instead of E_ERROR]
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-377@lists.php.net to get a copy of this message
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

« previous php.internals (#377) next »