[TYPO3-core] optional array arguments

Martin Kutschker Martin.Kutschker at blackbox.net
Wed Apr 26 14:56:48 CEST 2006


Franz Holzinger <franz at fholzinger.com> writes on 
Wed, 26 Apr 2006 14:09:51 +0200 (METDST):

>
> However if it is an empty array then $variable = array() should get
> used here. With this you can avoid an additional if to check if the
> passed parameter is an array.


No, because it's only guaranteed that the default is an empty array. We have to check because the calling code might pass anything to the function.

We'd need PHP 5.1 and it's array type hinting feature to avoid the check.

Masi




More information about the TYPO3-team-core mailing list