Re: Help with typecasting by default in the function parameter list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, November 21, 2006 8:40 am, Jared Farrish wrote:
> Is this legal? Note where the typecasting occurs: In the function
> parameter
> list, before the variable.
>
> <code>
> function doSomething( (int) $int1, (int) $int2 ) {
>     //blah blah
> }
> </code>
>
> This would take the place of:
>
> <code>
> function doSomething($int1, $int2) {
>     $int1 = (int) $int1;
>     $int2 = (int) $int2;
> }
> </code>
>
> Is this possible?

You could try it and see faster than posting...

It won't work, and if the syntax DID parse, it would probably be "type
hinting" rather than "type casting" which means it would possibly
throw an error/notice/warning/whatever if your data coming in was not
(int) type.

AFAIK, PHP does not support this for (int) in any current version, and
plans for the future are nebulous in this regard.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux