Re: [PHP-DEV] [VOTE][RFC] Scalar Type Hinting with Cast

[email protected] (Andrea Faulds)
Newsgroups php.internals
Message-ID <[email protected]>
On 14 Sep 2014, at 01:07, Alain Williams <[email protected]> wrote:

> You give an option for float to int casting to truncate.

Where?

    oa-res-27-90:php-src ajf$ sapi/cli/php -r 'function foobar(int $a) { var_dump($a); } foobar(1.5);'
    
    Catchable fatal error: Argument 1 passed to foobar() must be of the type int, float given, called in Command line code on line 1 and defined in Command line code on line 1

If you mean under possible changes, it’s not a change that’s been made. It’d only be worth discussing within the context of making it truncate or round.

--
Andrea Faulds
http://ajf.me/
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.