File tree Expand file tree Collapse file tree 1 file changed +24
-16
lines changed
reference/array/functions Expand file tree Collapse file tree 1 file changed +24
-16
lines changed Original file line number Diff line number Diff line change 8484 <programlisting role =" php" >
8585<![CDATA[
8686<?php
87+
8788$queue = [
8889 "orange",
8990 "banana"
9091];
9192
9293array_unshift($queue, "apple", "raspberry");
94+
9395var_dump($queue);
96+
9497?>
9598]]>
9699 </programlisting >
@@ -121,6 +124,7 @@ array(4) {
121124 <programlisting role =" php" >
122125<![CDATA[
123126<?php
127+
124128$foods = [
125129 'apples' => [
126130 'McIntosh' => 'red',
@@ -131,6 +135,7 @@ $foods = [
131135 'Valencia' => 'orange',
132136 ],
133137];
138+
134139$vegetables = [
135140 'lettuce' => [
136141 'Iceberg' => 'green',
@@ -147,49 +152,52 @@ $vegetables = [
147152];
148153
149154array_unshift($foods, $vegetables);
155+
150156var_dump($foods);
157+
158+ ?>
151159]]>
152160 </programlisting >
153161 &example.outputs;
154162 <screen role =" php" >
155163<![CDATA[
156164array(3) {
157- [0] =>
165+ [0]=>
158166 array(3) {
159- ' lettuce' =>
167+ [" lettuce"] =>
160168 array(2) {
161- ' Iceberg' =>
169+ [" Iceberg"] =>
162170 string(5) "green"
163- ' Butterhead' =>
171+ [" Butterhead"] =>
164172 string(5) "green"
165173 }
166- ' carrots' =>
174+ [" carrots"] =>
167175 array(2) {
168- ' Deep Purple Hybrid' =>
176+ [" Deep Purple Hybrid"] =>
169177 string(6) "purple"
170- ' Imperator' =>
178+ [" Imperator"] =>
171179 string(6) "orange"
172180 }
173- ' cucumber' =>
181+ [" cucumber"] =>
174182 array(2) {
175- ' Kirby' =>
183+ [" Kirby"] =>
176184 string(5) "green"
177- ' Gherkin' =>
185+ [" Gherkin"] =>
178186 string(5) "green"
179187 }
180188 }
181- ' apples' =>
189+ [" apples"] =>
182190 array(2) {
183- ' McIntosh' =>
191+ [" McIntosh"] =>
184192 string(3) "red"
185- ' Granny Smith' =>
193+ [" Granny Smith"] =>
186194 string(5) "green"
187195 }
188- ' oranges' =>
196+ [" oranges"] =>
189197 array(2) {
190- ' Navel' =>
198+ [" Navel"] =>
191199 string(6) "orange"
192- ' Valencia' =>
200+ [" Valencia"] =>
193201 string(6) "orange"
194202 }
195203}
You can’t perform that action at this time.
0 commit comments