
Wikis & learning
Build a list of PHP modules
A list keeps items in their insertion order. Use a list when position matters and you do not need to give each value a separate key.
A list keeps items in their insertion order. Use a list when position matters and you do not need to give each value a separate key.
How it works
Append one item with empty brackets. The indexes in this example start at zero.
PHP example
<?php
$modules = ['Routing', 'Templates'];
$modules[] = 'Storage';
echo $modules[0] . ' / ' . $modules[2];Expected result
Routing / Storage
Try a variation
Add a fourth module before printing and show its name.
Discussion
Sign in to participate.



