From 6d9f8593cbf6e1c5926aafa3d799da901a688154 Mon Sep 17 00:00:00 2001 From: Daniele Pedone Date: Mon, 17 Dec 2018 06:06:35 +0100 Subject: [PATCH] Update index.md to add a new item into php array (#31333) --- guide/english/php/array/index.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/guide/english/php/array/index.md b/guide/english/php/array/index.md index a7b349a9ed..d4ac4b0e67 100644 --- a/guide/english/php/array/index.md +++ b/guide/english/php/array/index.md @@ -84,6 +84,33 @@ Would produce the following output: I like Yamaha ``` +## Add Item + +Is possible to add any item to an existing array. + +An example of addition can be seen below: + +``` + 'Suzuki', + 'second favorite' => 'BMW' +]; + +$bikes['not my favorite'] = 'Yamaha'; +``` + ## Multidimensional Array As we mentioned earlier arrays are collection of items, often times these items may be arrays of themselves. @@ -92,7 +119,6 @@ As we mentioned earlier arrays are collection of items, often times these items You will always be able to get the value for the specific key by going down the layers: $arr['layerOne']['two'] - ## Pitfalls When working with arrays, there are a few important things to keep in mind: