File tree 1 file changed +24
-16
lines changed
reference/array/functions
1 file changed +24
-16
lines changed Original file line number Diff line number Diff line change 84
84
<programlisting role =" php" >
85
85
<![CDATA[
86
86
<?php
87
+
87
88
$queue = [
88
89
"orange",
89
90
"banana"
90
91
];
91
92
92
93
array_unshift($queue, "apple", "raspberry");
94
+
93
95
var_dump($queue);
96
+
94
97
?>
95
98
]]>
96
99
</programlisting >
@@ -121,6 +124,7 @@ array(4) {
121
124
<programlisting role =" php" >
122
125
<![CDATA[
123
126
<?php
127
+
124
128
$foods = [
125
129
'apples' => [
126
130
'McIntosh' => 'red',
@@ -131,6 +135,7 @@ $foods = [
131
135
'Valencia' => 'orange',
132
136
],
133
137
];
138
+
134
139
$vegetables = [
135
140
'lettuce' => [
136
141
'Iceberg' => 'green',
@@ -147,49 +152,52 @@ $vegetables = [
147
152
];
148
153
149
154
array_unshift($foods, $vegetables);
155
+
150
156
var_dump($foods);
157
+
158
+ ?>
151
159
]]>
152
160
</programlisting >
153
161
&example.outputs;
154
162
<screen role =" php" >
155
163
<![CDATA[
156
164
array(3) {
157
- [0] =>
165
+ [0]=>
158
166
array(3) {
159
- ' lettuce' =>
167
+ [" lettuce"] =>
160
168
array(2) {
161
- ' Iceberg' =>
169
+ [" Iceberg"] =>
162
170
string(5) "green"
163
- ' Butterhead' =>
171
+ [" Butterhead"] =>
164
172
string(5) "green"
165
173
}
166
- ' carrots' =>
174
+ [" carrots"] =>
167
175
array(2) {
168
- ' Deep Purple Hybrid' =>
176
+ [" Deep Purple Hybrid"] =>
169
177
string(6) "purple"
170
- ' Imperator' =>
178
+ [" Imperator"] =>
171
179
string(6) "orange"
172
180
}
173
- ' cucumber' =>
181
+ [" cucumber"] =>
174
182
array(2) {
175
- ' Kirby' =>
183
+ [" Kirby"] =>
176
184
string(5) "green"
177
- ' Gherkin' =>
185
+ [" Gherkin"] =>
178
186
string(5) "green"
179
187
}
180
188
}
181
- ' apples' =>
189
+ [" apples"] =>
182
190
array(2) {
183
- ' McIntosh' =>
191
+ [" McIntosh"] =>
184
192
string(3) "red"
185
- ' Granny Smith' =>
193
+ [" Granny Smith"] =>
186
194
string(5) "green"
187
195
}
188
- ' oranges' =>
196
+ [" oranges"] =>
189
197
array(2) {
190
- ' Navel' =>
198
+ [" Navel"] =>
191
199
string(6) "orange"
192
- ' Valencia' =>
200
+ [" Valencia"] =>
193
201
string(6) "orange"
194
202
}
195
203
}
You can’t perform that action at this time.
0 commit comments