Maybe the code looks like something like this:
foreach(...$POST){
echo $key."<br/>;
}
Maybe the code looks like something like this:
foreach(...$POST){
echo $key."<br/>;
}
See the PHP documentation on foreach: http://php.net/manual/en/control-structures.foreach.php
Your code would look something like this:
foreach ($_POST as $key=>$element) {
echo $key."<br/>";
}
var_dump($_POST);
or
print_r($_POST);
You might insert a pre tag before and after for the clearer output in your browser:
echo '<pre>';
var_dump($_POST);
echo '</pre>';
And I suggest to use Xdebug. It provides an enchanted var_dump that works without pre's as well.
And if you want full coverage of the whole array, print_r
or even more detailed var_dump
If you want to do something with them programmatically (eg turn them into a list or table), just loop:
foreach ($_POST as $k => $v) {
echo $k . "<br>";
}
For debugging purposes:
print_r($_POST);
or
var_dump($_POST);
$array = array_flip($array);
echo implode('any glue between array keys',$array);
Or you could just print out the array keys:
foreach (array_keys($_POST) as $key) {
echo "$key<br/>\n";
}
Normally I would use print_r($_POST)
.
If using within an HTML page, it's probably worth wrapping in a <pre>
tag to get a better looking output, otherwise the useful tabs and line breaks only appear in source view.