We got a PHP file in school with some functions and one of them is the following:
function serviceRec($db,$table,$afields=null,$avalues=null){ .... }
My question: What does the $afields=null and $avalues=null mean?
Thank you!
Sommaire |
We got a PHP file in school with some functions and one of them is the following:
function serviceRec($db,$table,$afields=null,$avalues=null){ .... }
My question: What does the $afields=null and $avalues=null mean?
Thank you!
function serviceRec($db,$table,$afields=null,$avalues=null){ .... }
It means that, when you call your function and don t pass those parameters then it ll by default place value as null
Example :
function hello($name = "anonymous"){ return "Hello $name "; } echo hello();//Hello anonymous echo hello("BigSeeProduction");//Hello BigSeeProduction
http://php.net/manual/en/functions.arguments.php#functions.arguments.default http://php.net/manual/en/functions.arguments.php#functions.arguments.default
License : cc by-sa 3.0
http://stackoverflow.com/questions/30545174/what-does-the-parameter-something-null-mean-in-php