how to create single array from a array list in php code example
Example 1: php array
<?php
$array = array(
"foo" => "bar",
42 => 24,
"multi" => array(
"dimensional" => array(
"array" => "foo"
)
)
);
var_dump($array["foo"]);
var_dump($array[42]);
var_dump($array["multi"]["dimensional"]["array"]);
?>
Example 2: php define array first 10 number
<?php
foreach (range(0, 12) as $number) {
echo $number;
}
foreach (range(0, 100, 10) as $number) {
echo $number;
}
foreach (range('a', 'i') as $letter) {
echo $letter;
}
foreach (range('c', 'a') as $letter) {
echo $letter;
}
?>