Re: [PHP] How to get the 'return type' of a function?

[email protected] (tedd)
Newsgroups php.general
Message-ID <p06240803c7a996ac8787@[192.168.1.102]>
At 3:17 PM +0100 2/23/10, Daniel Egeberg wrote:
>2010/2/23 Dasn <[email protected]>:
>  > Could you tell me how to retrieve the 'return type'?
>>  Thanks.
>>
>>
>>  --
>>  Dasn
>
>That's not possible. Consider this function:
>
>function foo()
>{
>	switch (rand(0, 1)) {
>		case 0: return 42;
>		case 1: return 'bar';
>	}
>}
>
>What should the return type be?
>
>--
>Daniel Egeberg


It can be anything you want to test for -- check out:

is_int();
is_nan();
is_float();
is_long();
is_string();

IOW, is_whatever();

Cheers,

tedd

-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.