Tools, FAQ, Tutorials:
Specifying Argument Default Values in PHP
How To Specify Argument Default Values? in PHP?
✍: 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
2016-12-04, 1271👍, 0💬
Popular Posts:
How to use "{{...}}" Liquid Codes in "set-body" Policy Statement? The "{{...}}" Liquid Codes in "set...
What is json.tool? Can I use it to convert a JSON string a pretty-print format? json.tool is a speci...
How to use "link" command tool to link objet files? If you have object files previously compiled by ...
How to create Hello-3.1.epub with WinRAR? I have all required files to create Hello-3.1.epub. To cre...
How To Add Column Headers to a Table? If you want to add column headers to a table, you need to use ...