Check Empty Array in PHP: Quick Guide

In PHP, you can use the empty() function to check if an array is empty. An example is shown below:

$arr = array();

if (empty($arr)) {
    echo "数组为空";
} else {
    echo "数组不为空";
}

The empty() function will return true if the array is empty, and false if the array is not empty.

bannerAds