Re: Re:[VOTE] Allow a trailing comma in function calls

From: Date: Sun, 22 Oct 2017 06:25:53 +0000
Subject: Re: Re:[VOTE] Allow a trailing comma in function calls
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-100913@lists.php.net to get a copy of this message
Hi CHU Zhaowei 2017-10-22 7:24 GMT+02:00 CHU Zhaowei <me@jhdxr.com>: > Hello Sammy, > > > I'd like to know if a trailing comma would affect the number of args or not. for example, > ``` > function foo(){ > return func_num_args(); > > } > foo('a','b',); > ``` > would return 2 or 3? With the current patch submitted for this RFC, your example will return 2, as it will simply ignore the trailing comma at the end of your call. You can see the more detailed test at github here[1]. [1] https://github.com/SammyK/php-src/compare/master...rfc-trailing-comma-function-calls#diff-88d4f8d1ae810e0722bf59cf1a739228 -- regards, Kalle Sommer Nielsen kalle@php.net

« previous php.internals (#100913) next »