All Vskills Certification exams are ONLINE now. You may take from any where any time | Please use #TOGETHER for 20% discount

Certified PHP Developer Learning Resources Creating or modifying Array

Creating/modifying Array

 An existing array can be modified by explicitly setting values in it.

This is done by assigning values to the array, specifying the key in brackets. The key can also be omitted, resulting in an empty pair of brackets ([]).

$arr[key] = value;
$arr[] = value;
// key may be an integer or string
// value may be any value of any type