I'm trying to port some PHP code over to C#, and I ran across a PHP function of this form:
function DoStuff($myVar, array $myArray1, array $myArray2 = array())
{
// some code not involving $myArray2
if ($myArray2)
{
// do things with $myArray2, but if I arrive here, what
// condition was met?
}
}
My best guess (which may be completely wrong) after looking over a number of appropriate pages in php.net as to what's happening:
-
$myArray2
is optional, but if nothing is provided the array goes in empty - The
if
conditional checks to see whether$myArray2
was passed in with one or more elements
Is this correct? If not, what is correct? Thanks!