I know this may be a silly question, but I come across a snippet of php code that check if the $_POST
is_array()
before execute other functions.
$_POST is always defined as an array even it doesn't contain any key/value pairs.
As already mentioned several times, $_POST
is a superglobal that is always defined and always an array (unless overwritten).
If you're attempting to test if something has been posted, you could use something like follows:
if (count($_POST)) {
// something has been submitted
}
To answer the main question, no, the is_array
check is not required.