Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use the empty () function in php

Shulou Source: shulou.com Published: 2022-05-31 11:00:19 11月03日 Update

This article mainly introduces the relevant knowledge of "how to use the empty () function in php". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to use the empty () function in php" can help you solve the problem.

Description

1. It is used to detect whether the variable is empty.

2. If the variable does not exist, or if its value is equal to FALSE, it is not considered to exist. If there are no variables, empty () will not issue a warning.

Grammar

Bool empty (mixed $var)

Example

/ / the empty () function checks whether a variable is empty public function check_empty () {$a =''; var_dump (empty ($a)); / / output true $b = null; var_dump (empty ($b)); / / output true $c = []; var_dump (empty ($c)); / / output true var_dump (empty ($d)) / / output true variable has no assignment, output true $e = false; var_dump (empty ($e)); / / output true, $e = false; var_dump (empty ($e)); / / output true false=0 if $e = true, output false $f = '0values; var_dump (empty ($f)); / / output true} on "how to use the empty () function in php" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Output variables functions knowledge industries different practical content examples practicality practice articles methods more cases knowledge points articles grammar information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL OPPO Reno NVidia Docker macOS