note 126016 added to functions.arguments
| From: | anisgazig at gmail dot com | Date: | Fri, 16 Apr 2021 09:31:18 +0000 |
| Subject: | note 126016 added to functions.arguments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216290@lists.php.net to get a copy of this message | ||
//VALUE PASSED BY ARGUMENT AND NO NEED TO USE GLOBAL KEYWORD
function myfun21($input){
echo "$input[0]+$input[1] = ", $input[0]+ $input[1];
}
$arr = array(10,20);
myfun21($arr);
echo "<br>";
/*
VALUE PASSED DIRECTLY NOT ARGUMENT SO UNDEFINE VARIABLE WILL BE SHOWN.
SO PASSING A VALUE DIRECTLY TO A FUNCTION PLEASE GLOBAL KEYWORD MUST BE USE
BEFORE VARIABLE.
*/
function myfunc22(){
global $arr;
return $arr;
}
$arr = [10,20];
echo "<pre>";
print_r(myfunc22());
echo "</pre>";
----
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.arguments.php
Edit -- https://main.php.net/note/edit/126016
Del: integrated -- https://main.php.net/note/delete/126016/integrated
Del: useless -- https://main.php.net/note/delete/126016/useless
Del: bad code -- https://main.php.net/note/delete/126016/bad+code
Del: spam -- https://main.php.net/note/delete/126016/spam
Del: non-english -- https://main.php.net/note/delete/126016/non-english
Del: in docs -- https://main.php.net/note/delete/126016/in+docs
Del: other reasons-- https://main.php.net/note/delete/126016
Reject -- https://main.php.net/note/reject/126016
Search -- https://main.php.net/manage/user-notes.php