Is passing NULL param exactly the same as passing no param
Posted
by
park
on Stack Overflow
See other posts from Stack Overflow
or by park
Published on 2011-01-01T08:45:48Z
Indexed on
2011/01/01
8:53 UTC
Read the original article
Hit count: 304
I'm working with a function whose signature looks like this
afunc(string $p1, mixed $p2, array $p3 [, int $p4 = SOM_CONST [, string $p5 ]] )
In some cases I don't have data for the last parameter $p5
to pass, but for the sake of consistency I still want to pass something like NULL
. So my question, does PHP treat passing a NULL exactly the same as not passing anything?
somefunc($p1, $p2, $p3, $p4 = SOM_CONST);
somefunc($p1, $p2, $p3, $p4 = SOM_CONST, NULL);
© Stack Overflow or respective owner