mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-30 10:38:00 +02:00
Update php.html.markdown
Added reference to add an element to an associative array.
This commit is contained in:
parent
a08051109f
commit
663f6e28f5
@ -146,6 +146,9 @@ echo $associative['One']; // prints 1
|
|||||||
$array = ['One', 'Two', 'Three'];
|
$array = ['One', 'Two', 'Three'];
|
||||||
echo $array[0]; // => "One"
|
echo $array[0]; // => "One"
|
||||||
|
|
||||||
|
// Add an element to an associative array
|
||||||
|
$array['Four'] = 4;
|
||||||
|
|
||||||
// Add an element to the end of an array
|
// Add an element to the end of an array
|
||||||
$array[] = 'Four';
|
$array[] = 'Four';
|
||||||
// or
|
// or
|
||||||
|
Loading…
x
Reference in New Issue
Block a user