php 中如何判断是否为空

WBOY
Release: 2016-06-20 12:37:28
Original
976 people have browsed it

```<?phperror_reporting(0);$a = ""; // 空$a = null; // 空$a = array(); // 空$a = false; // 空$a = 0; // 空$a = '0'; // 空$a = 1; // 不空$a = true; // 不空$a = array(1 => '1'); // 不空$a = ';'; // 不空$a = function () {echo 1;}; // 不空class a {};$a = new a(); // 不空if (!empty($a)) {    echo '不空';} else {    echo '空';}echo PHP_EOL;```
Copy after login

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!