[TYPO3-core] optional array arguments

Franz Holzinger franz at fholzinger.com
Wed Apr 26 14:09:51 CEST 2006


Hello Martin,

>Dmitry and I have changed the signature of getURL, so that it takes a third argument which is an array and optional.
>
>I wrote:
>
>function getURL($url, $includeHeader = 0, $requestHeaders = '')
>
>Dmitry wrote:
>
>function getURL($url, $includeHeader = 0, $requestHeaders = false)
>
>I don't like my version, but IMHO it's the way TYPO3 uses "undefined" arrays (there are lots of $arrayVar = '' pseudo-declarations all over the place). But I don't like Dmitry's version either.
>
>Coming from a C background I prefer "$var = NULL;" for such uses.
>
>Any opinions?
>
>  
>
almost everywhere in TYPO3 code files the expression $variable = '' is
used to define an empty default value for a string.
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.


Greets,

Franz






More information about the TYPO3-team-core mailing list