Multi dimension Array uitlezen
Ik ben echt slecht met Array's.
Zou iemand mij kunnen vertellen hoe ik onderstaande array het beste uitlees?
Heb momenteel:
Code (php)
Array zelf is:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
SimpleXMLElement Object
(
[Consignment] => SimpleXMLElement Object
(
[ConsignmentNumber] => 880618471
[OriginDepotName] => Zwolle
[CustomerReference] => RETURN 20160035
[CollectionDate] => 4 Feb 2016
[DeliveryTown] => ALMERE
[DeliveryDate] => 5 Feb 2016
[DeliveryTime] => 16:19
[Signatory] => michel
[SummaryCode] => Delivered
[Cou-Id-Dest] => Netherlands
[Cou-Id-Orig] => Netherlands
[SearchType] => C
[SearchKey] => 880618471
[TOPaccountNo] => 245500
[TOPaccountCouID] => Netherlands
[SenderaccountNo] => 245500
[SenderCouID] => Netherlands
[StatusData] => Array
(
[0] => SimpleXMLElement Object
(
[Status] => SHIPMENT DELIVERED IN GOOD CONDITION.
[LocalEventDate] => 5 Feb 2016
[LocalEventTime] => 16:19
[Depot] => Amsterdam Depot
)
[1] => SimpleXMLElement Object
(
[Status] => OUT FOR DELIVERY.
[LocalEventDate] => 5 Feb 2016
[LocalEventTime] => 10:23
[Depot] => Amsterdam Depot
)
[2] => SimpleXMLElement Object
(
[Status] => SHIPMENT RECEIVED AT TNT LOCATION
[LocalEventDate] => 5 Feb 2016
[LocalEventTime] => 04:42
[Depot] => Amsterdam Depot
)
[3] => SimpleXMLElement Object
(
[Status] => SHIPMENT IN TRANSIT.
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 22:08
[Depot] => Arnhem Hub
)
[4] => SimpleXMLElement Object
(
[Status] => SHIPMENT RECEIVED AT TRANSIT POINT.
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 21:53
[Depot] => Arnhem Hub
)
[5] => SimpleXMLElement Object
(
[Status] => SHIPMENT RECEIVED AT TNT LOCATION
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 21:44
[Depot] => Arnhem Hub
)
[6] => SimpleXMLElement Object
(
[Status] => SHIPMENT IN TRANSIT.
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 19:59
[Depot] => Zwolle
)
[7] => SimpleXMLElement Object
(
[Status] => SHIPMENT IN TRANSIT.
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 17:32
[Depot] => Zwolle
)
[8] => SimpleXMLElement Object
(
[Status] => SHIPMENT RECEIVED AT ORIGIN DEPOT.
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 17:31
[Depot] => Zwolle
)
[9] => SimpleXMLElement Object
(
[Status] => SHIPMENT COLLECTED FROM CUSTOMER
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 13:54
[Depot] => Zwolle
)
)
)
)
(
[Consignment] => SimpleXMLElement Object
(
[ConsignmentNumber] => 880618471
[OriginDepotName] => Zwolle
[CustomerReference] => RETURN 20160035
[CollectionDate] => 4 Feb 2016
[DeliveryTown] => ALMERE
[DeliveryDate] => 5 Feb 2016
[DeliveryTime] => 16:19
[Signatory] => michel
[SummaryCode] => Delivered
[Cou-Id-Dest] => Netherlands
[Cou-Id-Orig] => Netherlands
[SearchType] => C
[SearchKey] => 880618471
[TOPaccountNo] => 245500
[TOPaccountCouID] => Netherlands
[SenderaccountNo] => 245500
[SenderCouID] => Netherlands
[StatusData] => Array
(
[0] => SimpleXMLElement Object
(
[Status] => SHIPMENT DELIVERED IN GOOD CONDITION.
[LocalEventDate] => 5 Feb 2016
[LocalEventTime] => 16:19
[Depot] => Amsterdam Depot
)
[1] => SimpleXMLElement Object
(
[Status] => OUT FOR DELIVERY.
[LocalEventDate] => 5 Feb 2016
[LocalEventTime] => 10:23
[Depot] => Amsterdam Depot
)
[2] => SimpleXMLElement Object
(
[Status] => SHIPMENT RECEIVED AT TNT LOCATION
[LocalEventDate] => 5 Feb 2016
[LocalEventTime] => 04:42
[Depot] => Amsterdam Depot
)
[3] => SimpleXMLElement Object
(
[Status] => SHIPMENT IN TRANSIT.
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 22:08
[Depot] => Arnhem Hub
)
[4] => SimpleXMLElement Object
(
[Status] => SHIPMENT RECEIVED AT TRANSIT POINT.
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 21:53
[Depot] => Arnhem Hub
)
[5] => SimpleXMLElement Object
(
[Status] => SHIPMENT RECEIVED AT TNT LOCATION
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 21:44
[Depot] => Arnhem Hub
)
[6] => SimpleXMLElement Object
(
[Status] => SHIPMENT IN TRANSIT.
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 19:59
[Depot] => Zwolle
)
[7] => SimpleXMLElement Object
(
[Status] => SHIPMENT IN TRANSIT.
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 17:32
[Depot] => Zwolle
)
[8] => SimpleXMLElement Object
(
[Status] => SHIPMENT RECEIVED AT ORIGIN DEPOT.
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 17:31
[Depot] => Zwolle
)
[9] => SimpleXMLElement Object
(
[Status] => SHIPMENT COLLECTED FROM CUSTOMER
[LocalEventDate] => 4 Feb 2016
[LocalEventTime] => 13:54
[Depot] => Zwolle
)
)
)
)
Ik wil dus zodra hij bij StatusData aankomt, deze ook weer in keys en values uitspuugt.
Iemand enig idee?
Alvast bedankt!
Gewijzigd op 18/02/2016 13:13:47 door Joni Fleischer
if(!is_array($keys)):
foreach($keys as $key => $value):
Als het GEEN array is ga jij het doorlopen.
Maar moet er niet nog een foreach loop in??
Website: http://mijnpompen.nl/BETA/tnt/ECtracker.php
Toevoeging op 18/02/2016 13:17:41:
Wil dus ook dat hij bij statusdata niet 10 keer statusdata weergeeft, maar statusdata als aparte loop opnieuw uitspuugt.
Joni Fleischer op 18/02/2016 13:16:52:
Heb if(is_array) weggehaald..
Je moet dat niet weghalen, alleen de NOT (!).
SimpleXMLElement Object