note 92470 deleted from language.operators.execution by betz
| From: | betz@php.net | Date: | Fri, 13 Nov 2009 10:20:59 +0000 |
| Subject: | note 92470 deleted from language.operators.execution by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162857@lists.php.net to get a copy of this message | ||
Note Submitter: xd dot seth at deleteme gmail . com
----
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