Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
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, 5258👍, 0💬
Popular Posts:
How To Join a List of Keys with a List of Values into an Array? - PHP Script Tips - PHP Built-in Fun...
How To Get the Minimum or Maximum Value of an Array? - PHP Script Tips - PHP Built-in Functions for ...
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]? a[i] == *...
What is the difference between "calloc(...)" and "malloc(...)"? 1. calloc(...) allocates a block of ...
If XML does not have closing tag will it work? No, every tag in XML which is opened should have a cl...