简体   繁体   中英

PHP 4 Default Function Parameter

can I use this syntax under PHP 4 (default function parameter) :

function myFunction($arg1 = 'defaultValue') {}

Thanks.

Yes you can. And it can be overwritten like this:

<?php
$var = 'one';
myFunction($var);

function myFunction($arg1 = 'defaultValue') {
echo $arg1;
}
?>

the output would be one

Yes you definitely can do.

Hope it helps.

why don't you simply try it? yes, you can.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM