note 92470 added to language.operators.execution

From: Date: Sun, 26 Jul 2009 06:40:03 +0000
Subject: note 92470 added to language.operators.execution
Groups: php.notes 
Request: Send a blank email to php-notes+get-158729@lists.php.net to get a copy of this message
I was trying to execute the user imput in $_GET["cmd"], but this doesn't work: <?PHP echo $_GET["cmd"]; ?> Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /test.php on line 2 But I found other ways to make it work: <?PHP eval('echo '.$_GET["cmd"].';'); ?> <?PHP $cmd = $_GET["cmd"]; echo $cmd; ?> <?PHP echo $_GET[123]; ?> I think second is the best way. Hope it helps somebody ---- Server IP: 201.216.232.3 Probable Submitter: 190.245.246.86 ---- Manual Page -- http://www.php.net/manual/en/language.operators.execution.php Edit -- https://master.php.net/note/edit/92470 Del: integrated -- https://master.php.net/note/delete/92470/integrated Del: useless -- https://master.php.net/note/delete/92470/useless Del: bad code -- https://master.php.net/note/delete/92470/bad+code Del: spam -- https://master.php.net/note/delete/92470/spam Del: non-english -- https://master.php.net/note/delete/92470/non-english Del: in docs -- https://master.php.net/note/delete/92470/in+docs Del: other reasons-- https://master.php.net/note/delete/92470 Reject -- https://master.php.net/note/reject/92470 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158729) next »