How to judge whether php is not equal to empty: First create a PHP sample file; then use the foreach loop method and functions such as empty and "is_numeric" to implement the judgment logic of not equal to empty; finally execute the file.
PHP determines that 0 is not empty
determines that 0 is empty or a number, so that 0 will not be Treated as empty
foreach ($param as $k=>$v){ // 为空或者为数字 if (!empty($v) || is_numeric($v)){ if ($i == 0){ $sign .= $k.'='.$v; }else{ $sign .= '&' . $k.'='.$v; } } $i++; }
For more related knowledge, please visit PHP Chinese website!
The above is the detailed content of How to determine if 0 is not equal to empty in php. For more information, please follow other related articles on the PHP Chinese website!