, Traversing the array

Source: Internet
Author: User
For help, the traversal array has such an array. now I can get the data array & nbsp; method $ data-& gt; data, and now I want to traverse the data below the data cyclically. I use this form of for, but the failure $ data-& gt; $ I-& gt; zqdm can also be pointed out by experts. The original array is PH for help, traversing the array
There is such an array

Now I can get the data array
Method:

$ Data-> data

Now I want to traverse the data below the data in a loop. I use
In this form, but failed
$ Data-> $ I-> zqdm
Please give me some advice.

The original array is
PHP code
  StdClass Object ([totalPages] => 30 [p] => 1 [totalCount] => 299 [data] => Array ([0] => stdClass Object ([uin] => 843035290 [grpId] => 0 [jydm] => [zqdm] => 600251 [zqjc] => why? call [type] => s [cbj] => 21.97 [amount] => 1000 [date] => 09:32:41) [1] => stdClass Object ([uin] => 843035290 [grpId] => 0 [jydm] => [zqdm] => 600251 [zqjc] => Zookeeper without authorization 'call [type] => B [cbj] => 22.29 [amount] => 1 000 [date] => 14:34:08) [2] => stdClass Object ([uin] => 843035290 [grpId] => 0 [jydm] => [zqdm] => 600537 [zqjc] => zookeeper? Too many tasks? [Type] => s [cbj] => 21.6 [amount] => 1000 [date] => 13:00:24 )))


------ Solution --------------------
I don't know what you're talking about.
------ Solution --------------------
[Data] => Array
(
[0] => stdClass Object

Note: data is an array.
$ Data-> data [$ I]-> zqdm
------ Solution --------------------
$ Data-> data [$ I]-> zqdm
------ Solution --------------------
Use foreach $ data-> data as $ k => $ v. simpleXML in the manual can find relevant information.
------ Solution --------------------
Unless you provide the error data
PHP code
$ D-> data [2]-> x = 'abc'; print_r ($ d); echo $ d-> data [2]-> x;
------ Solution --------------------
Discussion

$ Data-> data [$ I]-> zqdm

------ Solution --------------------
Foreach ($ data-> data as $ k => $ v ){
Echo $ k. '=>'. $ v .'
';
}
------ Solution --------------------
No echo. use print_r.
------ Solution --------------------
Discussion

Error,

Notice: Undefined variable: s in

Foreach ($ data-> data as $ k => $ v ){
Echo"
"; Print_r ($ k." => ". $ s );
}
Reference:

Foreach ($ data-> data as $ k => $ v ){
Echo $ k. '=>'. $ v .'
'......

------ Solution --------------------
Syntax error, unexpected T_EXIT, expect T_FUNCTION ???

How do you know where the error is?

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.