Get the App
SLTechnology News&Howtos  ›  Development  › 

How does PHP determine whether arrays and keys exist?

Shulou Source: shulou.com Published: 2022-06-01 04:49:48 10月05日 Update

This article is about how PHP determines the existence of arrays and keys. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

PHP determines whether the array key exists isset (), array_key_exists (), empty ().

$array = ['array = >' I'm the first', 'baked = >' I'm the second', 'centering = >' I'm the third','f' = > null]; if (isset ($array ['a'])) {echo'an exists';} else {echo'a does not exist';} if (array_key_exists ('array, $array)) {echo'd exists';} else {echo'd does not exist'; } if (empty ($array ['f']) {echo'f does not exist';} else {echo'f does not exist and is not null,0, "0", false';} / / a does not exist d does not exist f does not exist thank you for reading! This is the end of the article on "how to determine the existence of arrays and keys in PHP". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Tags: Array content more articles good practical three articles read knowledge reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Xiaomi Shulou Information Docker Apple