Var_dump (isset ($a [' Cake '] [' a '] [' B ']); What do you mean? How to fix it

Source: Internet
Author: User
Var_dump (isset ($a [' Cake '] [' a '] [' B ']); What do you mean?
http://us1.php.net/manual/zh/function.isset.php
 
  
$a = array (' test ' = = 1, ' hello ' = NULL, ' pie ' = = Array (' a ' = ' = ' apple '));

Var_dump (isset ($a [' Test ']); TRUE
Var_dump (isset ($a [' foo ']); FALSE
Var_dump (isset ($a [' hello ']); FALSE

The value of the key ' hello ' is equal to NULL, so it is considered to be an unassigned value.

Var_dump (array_key_exists (' hello ', $a)); TRUE

Checking Deeper Array values
Var_dump (isset ($a [' Pie '] [' a ']);
Var_dump (isset ($a [' Pie '] [' B ']); FALSE
Var_dump (isset ($a [' Cake '] [' a '] [' B ']); FALSE



Var_dump (isset ($a [' Pie '] [' a ']); and Var_dump (the isset ($a [' Cake '] [' a '] [' B ']); Please explain in detail, I have learned C language before, but I feel PHP is so difficult to understand.

Share to: more


------Solution--------------------
Var_dump () printed meaning,
Array () to create a
The test=>1 test indicates that the array's key 1 represents the value of the array, followed by the
$a [test] is the value of the test key inside the array.
The value of a pie key in this array is also an array so $a is a two-dimensional array.
$a [Pie][a] is to take the Apple value inside the pie array inside this array.
Isset is the idea that there is no such value.



------Solution--------------------
$a [' Cake '] [' a '] [' B '] an element of a multidimensional associative array
Although there is no associative key array in C, array elements such as a[1][2][3] are common.

------Solution--------------------
Prints the value of a multidimensional array setting.
Var_dump () Print
$a [' Cake '] [' a '] [' B '] multidimensional array
Isset () sets the value
------Solution--------------------
Determines whether the array is set if there is a corresponding key in the array true else false
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.