2

When I check value of an array using var_dump() function.

var_dump($data['content']);

I have result

array(1) { [0]=> array(10) { ["IDUser"]=> string(1) "1" ["Name"]=> string(5) "admin" ["Password"]=> string(32) "44ca5fa5c67e434b9e779c5febc46f06" ["Fullname"]=> string(18) "Nguyễn Tá Lợi" ["Gender"]=> string(1) "0" ["Birthday"]=> string(10) "0000-00-00" ["Address"]=> string(0) "" ["Email"]=> string(0) "" ["PhoneNumber"]=> string(0) "" ["Status"]=> string(1) "1" } }

I want get value with key ["Name"] so I use $data['content']['Name'] but it's incorrect
How to get value of "Name" in this array?

2
  • 3
    Use $data['content'][0]['Name'] Commented Jan 30, 2016 at 19:09
  • @RajdeepPaul: I got it ! Commented Jan 30, 2016 at 19:11

2 Answers 2

3

$data['content'][0]['Name'] should do it

Sign up to request clarification or add additional context in comments.

Comments

2

Value of Name is available on 0 index of content so you can not get the Name value as:

$data['content']['Name']

You need to get Name as:

$data['content'][0]['Name'] // add 0 index of content.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.