note 86852 added to control-structures.if

From: Date: Thu, 06 Nov 2008 17:36:57 +0000
Subject: note 86852 added to control-structures.if
Groups: php.notes 
Request: Send a blank email to php-notes+get-146242@lists.php.net to get a copy of this message
Here is a way to declare global variable variables using a function. This particular example handles an array that contains names of $_POST items. This is to avoid the notices that php gives when checking an unused $_POST. function check ($inputs) { foreach ($inputs as $input) { global $$input; $$input = isset($_POST[$input]) ? $_POST[$input] : ""; } } ---- Server IP: 195.184.96.15 Probable Submitter: 192.38.109.188 ---- Manual Page -- http://www.php.net/manual/en/control-structures.if.php Edit -- https://master.php.net/note/edit/86852 Del: integrated -- https://master.php.net/note/delete/86852/integrated Del: useless -- https://master.php.net/note/delete/86852/useless Del: bad code -- https://master.php.net/note/delete/86852/bad+code Del: spam -- https://master.php.net/note/delete/86852/spam Del: non-english -- https://master.php.net/note/delete/86852/non-english Del: in docs -- https://master.php.net/note/delete/86852/in+docs Del: other reasons-- https://master.php.net/note/delete/86852 Reject -- https://master.php.net/note/reject/86852 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146242) next »