php loop through object

Solutions on MaxInterview for php loop through object by the best coders in the world

showing results for - "php loop through object"
Jona
29 Sep 2020
1foreach ($obj as $key => $value) {
2    echo "$key => $value\n";
3    //echo "test greper";
4}
5
Maxence
05 Feb 2020
1foreach ($obj as $key => $value) {
2  echo "$value\n";
3}
Nicola
22 Mar 2019
1foreach ($obj as $key => $value) {
2    echo "$key => $value\n";
3}
Amelia
19 Oct 2016
1$person = new StdClass();
2$person->name = "Taylor";
3$person->age = 31;
4
5foreach ($person as $key => $value) {
6    echo $key.",".$value."\n";
7}$person = new StdClass();
8$person->name = "Taylor";
9$person->age = 31;
10
11foreach ($person as $key => $value) {
12    echo $key.",".$value."\n";
13}$person = new StdClass();
14$person->name = "Taylor";
15$person->age = 31;
16
17foreach ($person as $key => $value) {
18    echo $key.",".$value."\n";
19}$person = new StdClass();
20$person->name = "Taylor";
21$person->age = 31;
22
23foreach ($person as $key => $value) {
24    echo $key.",".$value."\n";
25}$person = new StdClass();
26$person->name = "Taylor";
27$person->age = 31;
28
29foreach ($person as $key => $value) {
30    echo $key.",".$value."\n";
31}$person = new StdClass();
32$person->name = "Taylor";
33$person->age = 31;
34
35foreach ($person as $key => $value) {
36    echo $key.",".$value."\n";
37}$person = new StdClass();
38$person->name = "Taylor";
39$person->age = 31;
40
41foreach ($person as $key => $value) {
42    echo $key.",".$value."\n";
43}$person = new StdClass();
44$person->name = "Taylor";
45$person->age = 31;
46
47foreach ($person as $key => $value) {
48    echo $key.",".$value."\n";
49}$person = new StdClass();
50$person->name = "Taylor";
51$person->age = 31;
52
53foreach ($person as $key => $value) {
54    echo $key.",".$value."\n";
55}$person = new StdClass();
56$person->name = "Taylor";
57$person->age = 31;
58
59foreach ($person as $key => $value) {
60    echo $key.",".$value."\n";
61}$person = new StdClass();
62$person->name = "Taylor";
63$person->age = 31;
64
65foreach ($person as $key => $value) {
66    echo $key.",".$value."\n";
67}$person = new StdClass();
68$person->name = "Taylor";
69$person->age = 31;
70
71foreach ($person as $key => $value) {
72    echo $key.",".$value."\n";
73}$person = new StdClass();
74$person->name = "Taylor";
75$person->age = 31;
76
77foreach ($person as $key => $value) {
78    echo $key.",".$value."\n";
79}$person = new StdClass();
80$person->name = "Taylor";
81$person->age = 31;
82
83foreach ($person as $key => $value) {
84    echo $key.",".$value."\n";
85}$person = new StdClass();
86$person->name = "Taylor";
87$person->age = 31;
88
89foreach ($person as $key => $value) {
90    echo $key.",".$value."\n";
91}$person = new StdClass();
92$person->name = "Taylor";
93$person->age = 31;
94
95foreach ($person as $key => $value) {
96    echo $key.",".$value."\n";
97}
Noah
09 Feb 2019
1foreach ($obj as $key => $value) {
2    echo "$key => $value\n";
3}
4
Sara
22 Jul 2018
1foreach ($objects as $obj){
2      echo $obj->user->description;
3}
4
Alan
04 Jun 2016
1foreach ($objects as $obj) {
2   echo $obj->property;
3}