php ... array code example
Example 1: array php
<?php
$array = array(
"foo" => "bar",
"bar" => "foo",
);
$array = [
"foo" => "bar",
"bar" => "foo",
];
?>
Example 2: php array
<html>
<body>
<?php
$numbers = array( 1, 2, 3, 4, 5);
foreach( $numbers as $value ) {
echo "Value is $value <br />";
}
$numbers[0] = "one";
$numbers[1] = "two";
$numbers[2] = "three";
$numbers[3] = "four";
$numbers[4] = "five";
foreach( $numbers as $value ) {
echo "Value is $value <br />";
}
?>
</body>
</html>
Example 3: php array
$array = ['cheese', 'ham', 'potato'];
var_dump($array);