1<?php
2
3$array = array("size" => "XL", "color" => "gold");
4
5print_r(array_values($array));
6
7?>
1
2<?php
3$array = array("size" => "XL", "color" => "gold");
4print_r(array_values($array));
5?>
6// ["XL","gold"]
7
8
1
2<?php
3$array = array(
4 "foo" => "bar",
5 "bar" => "foo",
6);
7
8// as of PHP 5.4
9$array = [
10 "foo" => "bar",
11 "bar" => "foo",
12];
13?>
14
15
1<?php
2
3function data() {
4 $out[0] = "abc";
5 $out[1] = "def";
6 $out[2] = "ghi";
7 return $out;
8}
9
10$data = data();
11foreach($data as $items){
12 echo $items;
13}
14
1<?php
2$array = array(
3 "foo" => "bar",
4 "bar" => "foo",
5);
6
7// as of PHP 5.4
8$array = [
9 "foo" => "bar",
10 "bar" => "foo",
11];
12?>
13