PHP 8
Beginner
Basics
· 1 min read
Indexed arrays
How do I store a list in PHP?
Numeric indexes from 0.
Example
<?php
$colors = ['red', 'green', 'blue'];
echo $colors[0];
$colors[] = 'yellow';
Line-by-Line Walkthrough
Appending with $arr[] pushes to the end.