Home  >  Article  >  Backend Development  >  javascript, php code to obtain function parameter object_PHP tutorial

javascript, php code to obtain function parameter object_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:31:37833browse

For example:

Copy code The code is as follows:

function say () {
alert (arguments[0]+' Say:'+arguments[1]);
}
say ('fanglor','fanglor is a boy!');

Result: Pop up fanglor Say: fanglor is a boy !
------------------------------------------------ ----------------------------------
This is somewhat similar to the func_get_args() function in php. Also gets the array of function parameters.
Example (the following is the php code):
Copy code The code is as follows:

function uses () {
$args =func_get_args();
if (!empty($args)) {
foreach ($args as $key => $val ) {
if (file_exists($val.'. php')) {
include "{$val}.php";
} else {
if (DEBUG) {
echo "{$val}.php does not exist!";
>}
}
}
}
}
//Encapsulate again include
uses ('config','db');

Automatically Load config.php and db.php. If they do not exist, {__file__}.php does not exist.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322977.htmlTechArticleFor example: Copy the code as follows: function say () { alert (arguments[0]+'say:'+ arguments[1]); } say ('fanglor','fanglor is a boy!'); Result: pop up fanglor saying: fanglor is a boy...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn