[php] How to check whether an array is empty using PHP?

An empty array is falsey in PHP, so you don't even need to use empty() as others have suggested.

<?php
$playerList = array();
if (!$playerList) {
    echo "No players";
} else {
    echo "Explode stuff...";
}
// Output is: No players

PHP's empty() determines if a variable doesn't exist or has a falsey value (like array(), 0, null, false, etc).

In most cases you just want to check !$emptyVar. Use empty($emptyVar) if the variable might not have been set AND you don't wont to trigger an E_NOTICE; IMO this is generally a bad idea.