Source Code:
(back to article)
<?php /* method of creating an Empty array. */ $firstempty = []; echo "Created First empty array <br>"; /* method of creating the Second Empty array. */ $second = []; echo "Created second empty array<br>"; /* the First method of creating an array. */ $first = [1, 2]; foreach ($first as $value) { echo "Value is $value <br>"; } /* The Second method of creating an array. */ $first[0] = "one"; $first[1] = "two"; foreach ($first as $value) { echo "Value is $value <br>"; } ?>
Result:
Report an issue