note 126099 added to functions.user-defined
| From: | anisgazig at gmail dot com | Date: | Sat, 22 May 2021 03:07:09 +0000 |
| Subject: | note 126099 added to functions.user-defined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216414@lists.php.net to get a copy of this message | ||
<?php
//variable-length argument list with variable number arguments & default arguments.
function myName1($b,...$a){
print_r($a);//Array ( [0] => Bar [1] => Baz )
echo "<br>";
echo $b;//Foo
}
$x = "Foo";
$y = "Bar";
$z = "Baz";
myName1($x,$y,$z);
echo "<br>";
function myName2($b="John",...$a){
print_r($a);//Array ( [0] => Bar [1] => Baz )
echo "<br>";
echo $b;//Foo
}
$x = "Foo";
$y = "Bar";
$z = "Baz";
myName2($x,$y,$z);
echo "<br>";
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 103.120.33.26)
----
Manual Page -- https://php.net/manual/en/functions.user-defined.php
Edit -- https://main.php.net/note/edit/126099
Del: integrated -- https://main.php.net/note/delete/126099/integrated
Del: useless -- https://main.php.net/note/delete/126099/useless
Del: bad code -- https://main.php.net/note/delete/126099/bad+code
Del: spam -- https://main.php.net/note/delete/126099/spam
Del: non-english -- https://main.php.net/note/delete/126099/non-english
Del: in docs -- https://main.php.net/note/delete/126099/in+docs
Del: other reasons-- https://main.php.net/note/delete/126099
Reject -- https://main.php.net/note/reject/126099
Search -- https://main.php.net/manage/user-notes.php