frequently ask ? : Computers : Programming : Languages : PHP : kms : Functions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 10 people (80%) answered Yes
Recently 5 of 7 people (71%) answered Yes

Entry

How can make the warning message for missing arguments disappear without having to provide all of a function's arguments. I don't get this err b4.

May 21st, 2001 17:38
Onno Benschop, Marnie Calubaquib,


Specify the default values:
function makeCoffee($withSuger=yes) {
  doSomething ;
}
You can then call it:
$cup = makeCoffee() ;
Or:
$cup = makeCoffee('no') ;