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

藏色散人
Release: 2023-03-02 16:56:01
Original
4749 people have browsed it

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++;
        }
Copy after login

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!

Related labels:
php
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template