mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
add examples of 2nd/3rd array depths for isset() (doc #54251)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@310529 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
22ac47b4fe
commit
79069a88f1
1 changed files with 6 additions and 1 deletions
|
@ -114,7 +114,7 @@ var_dump(isset($foo)); // FALSE
|
|||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$a = array ('test' => 1, 'hello' => NULL);
|
||||
$a = array ('test' => 1, 'hello' => NULL, 'pie' => array('a' => 'apple'));
|
||||
|
||||
var_dump(isset($a['test'])); // TRUE
|
||||
var_dump(isset($a['foo'])); // FALSE
|
||||
|
@ -124,6 +124,11 @@ var_dump(isset($a['hello'])); // FALSE
|
|||
// If you want to check for NULL key values then try:
|
||||
var_dump(array_key_exists('hello', $a)); // TRUE
|
||||
|
||||
// Checking deeper array values
|
||||
var_dump(isset($a['pie']['a'])); // TRUE
|
||||
var_dump(isset($a['pie']['b'])); // FALSE
|
||||
var_dump(isset($a['cake']['a']['b'])); // FALSE
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue