From 663f6e28f54a106204b9656d7a1ece1e9f225bcf Mon Sep 17 00:00:00 2001 From: Patrick Lee Date: Thu, 18 Feb 2016 15:59:00 -0500 Subject: [PATCH 1/3] Update php.html.markdown Added reference to add an element to an associative array. --- php.html.markdown | 3 +++ 1 file changed, 3 insertions(+) diff --git a/php.html.markdown b/php.html.markdown index ce178a15..0be8b427 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -146,6 +146,9 @@ echo $associative['One']; // prints 1 $array = ['One', 'Two', 'Three']; echo $array[0]; // => "One" +// Add an element to an associative array +$array['Four'] = 4; + // Add an element to the end of an array $array[] = 'Four'; // or From a5ae0795ba9e947b6b766707a0b93e5032ba8615 Mon Sep 17 00:00:00 2001 From: Patrick Lee Date: Thu, 18 Feb 2016 16:30:21 -0500 Subject: [PATCH 2/3] Update php.html.markdown Moved to group with associative arrays. --- php.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/php.html.markdown b/php.html.markdown index 0be8b427..4acdef98 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -142,13 +142,13 @@ $associative = ['One' => 1, 'Two' => 2, 'Three' => 3]; echo $associative['One']; // prints 1 +// Add an element to an associative array +$array['Four'] = 4; + // List literals implicitly assign integer keys $array = ['One', 'Two', 'Three']; echo $array[0]; // => "One" -// Add an element to an associative array -$array['Four'] = 4; - // Add an element to the end of an array $array[] = 'Four'; // or From c50ff1ddc874ace092507982f881510b27a2e173 Mon Sep 17 00:00:00 2001 From: Patrick Lee Date: Thu, 18 Feb 2016 16:38:15 -0500 Subject: [PATCH 3/3] Update php.html.markdown Changed var name to $associative --- php.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php.html.markdown b/php.html.markdown index 4acdef98..6944390c 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -143,7 +143,7 @@ $associative = ['One' => 1, 'Two' => 2, 'Three' => 3]; echo $associative['One']; // prints 1 // Add an element to an associative array -$array['Four'] = 4; +$associative['Four'] = 4; // List literals implicitly assign integer keys $array = ['One', 'Two', 'Three'];