Re: function with argument of type array

From: Date: Thu, 28 Jul 2005 11:45:17 +0000
Subject: Re: function with argument of type array
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-219482@lists.php.net to get a copy of this message
On 28 Jul 2005, at 12:07, André Medeiros wrote:
On Thu, 2005-07-28 at 11:08 +0200, marc serra wrote:
Hi, i want to know if it is possible to create a function and declare that one of its arguments is array type. In fact i want to do something like this function test(String $litteral, array $foo){
There is no way to do that. What you _CAN_ do, to ensure you're getting an array is:
There IS a way to do exactly this. It's called type hinting and it's a PHP 5 feature: http://www.php.net/manual/en/language.oop5.typehinting.php Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture marcus@synchromedia.co.uk | http://www.synchromedia.co.uk

« previous php.general (#219482) next »