Home >Backend Development >PHP Problem >How to determine if 0 is not equal to empty in php

How to determine if 0 is not equal to empty in php

藏色散人
藏色散人Original
2020-07-18 09:20:494698browse

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.

How to determine if 0 is not equal to empty in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn