To do this you can use the array itself, due to PHP's loose typing, or if you prefer a stricter approach - use count():
if (!$playerlist) {
// list is empty.
}
if (count($playerlist) === 0) {
// list is empty.
}
To prevent explodeing weird strings you have to clean out empty values before checking :
foreach ($playerlist as $key => $value) {
if (!strlen($value)) {
unset($playerlist[$key]);
}
}
if (!$playerlist) {
//empty array
}
I hope this helps you.