News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Phil Sturgeon:
Potential Variadic Function Syntax for PHP 5.6
September 03, 2013 @ 11:55:37

Phil Sturgeon has another post to his site about a recently proposed RFC for PHP. This time it's about implementing a variadic function syntax in the language. This kind of handling would allow for a variable number of parameters on a function/method and not having to use func_get_args to pull in the list.

An awesome RFC popped up the other day: Syntax for variadic functions, developed by Nikita Popov. I read through it and I loved it, but I did have to Google to see what the hell a variadic function was. This is what happens when you teach yourself how to code. You know how to do things, but don't know any of the words. Variadic functions are already possible in PHP and have been throughout 4.x and 5.x in the form of func_get_args(), which is pretty gross.

He includes an example of how it would work and some of the pros and cons of implementing it in the language including:

  • Type hinting (pro)
  • Argument unpacking (con)
  • Easier documentation in docblocks (pro)
  • Keeping up with the "Joneses" (con)
0 comments voice your opinion now!
variadic function syntax rfc proposal

Link: http://philsturgeon.co.uk/blog/2013/08/potential-variadic-function-syntax-for-php-56

blog comments powered by Disqus

Similar Posts

DevShed: Tracking a Stack of Function Calls with the Xdebug Extension

PHPClasses.org: 26 Ways to Show that PHP Can Be Better Than PHP

Davey Shafik's Blog: Zend_Service_Server: The Full Deal

PHP Tip-a-Day: PHP Tutorial: Convoluted Code - Combining Ternary Operators and Anonymous Functions

Community News: OgoProject Wants to Clean Up PHP


Community Events





Don't see your event here?
Let us know!


composer opinion voicesoftheelephpant introduction series podcast laravel version symfony interview framework security community library release language tool conference list artisanfiles

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework