Categories:
.NET (357)
C (330)
C++ (184)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (2)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Specify Argument Default Values
How To Specify Argument Default Values? - PHP Script Tips - Creating Your Own Functions
✍: FYIcenter.com
If you want to allow the caller to skip an argument when calling a function, you can define the argument with a default value when defining the function. Adding a default value to an argument can be done like this "function name($arg=expression){}. Here is a PHP script on how to specify default values to arguments:
<?php
function printKey($key="download") {
print("PHP $key\n");
}
printKey();
printKey("hosting");
print("\n");
?>
This script will print:
PHP download PHP hosting
2007-04-25, 5330👍, 0💬
Popular Posts:
1. The basics first, please define the web in simple language? How is it connected with internet? Wh...
Can include files be nested? The answer is yes. Include files can be nested any number of times. As ...
What will be printed as the result of the operation below: main() { int x=10, y=15; x = x++; y = ++y...
How does multi-threading take place on a computer with a single CPU? The operating system's task sch...
How do we create DCOM object in VB6? Using the CreateObject method you can create a DCOM object. You...