note 128420 added to language.variables.variable

From: Date: Sat, 22 Apr 2023 11:59:15 +0000
Subject: note 128420 added to language.variables.variable
Groups: php.notes 
Request: Send a blank email to php-notes+get-220374@lists.php.net to get a copy of this message
Superglobals can be referenced variably within a function, by calling them global: <?php function get_var($varname){ global $$varname; var_dump( $$varname); } get_var('_POST'); ?> (Note originally posted at https://www.php.net/manual/en/language.variables.superglobals.php#128418 but also appropriate here) ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.130 (proxied: 217.100.185.202) ---- Manual Page -- https://php.net/manual/en/language.variables.variable.php Edit -- https://main.php.net/note/edit/128420 Del: integrated -- https://main.php.net/note/delete/128420/integrated Del: useless -- https://main.php.net/note/delete/128420/useless Del: bad code -- https://main.php.net/note/delete/128420/bad+code Del: spam -- https://main.php.net/note/delete/128420/spam Del: non-english -- https://main.php.net/note/delete/128420/non-english Del: in docs -- https://main.php.net/note/delete/128420/in+docs Del: other reasons-- https://main.php.net/note/delete/128420 Reject -- https://main.php.net/note/reject/128420 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220374) next »