From bc4e29521be2640316c9138b4928dd786d98c365 Mon Sep 17 00:00:00 2001 From: Renato Francia Castillo Date: Fri, 1 Aug 2025 10:34:31 -0500 Subject: [PATCH] Update code example in PHP roadmap (#8973) --- .../associative-arrays@i_NRsOJNNp7AOqMgu5Jg8.md | 6 +++--- .../indexed-arrays@j2S8dP3HlAOOoZdpj-7Dx.md | 4 ++-- ...lti-dimensional-arrays@uARTOZ-ZwugSmbCJoRS5Y.md | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/data/roadmaps/php/content/associative-arrays@i_NRsOJNNp7AOqMgu5Jg8.md b/src/data/roadmaps/php/content/associative-arrays@i_NRsOJNNp7AOqMgu5Jg8.md index 1e62ad4c3..d3d2b47fc 100644 --- a/src/data/roadmaps/php/content/associative-arrays@i_NRsOJNNp7AOqMgu5Jg8.md +++ b/src/data/roadmaps/php/content/associative-arrays@i_NRsOJNNp7AOqMgu5Jg8.md @@ -3,15 +3,15 @@ Associative arrays in PHP are a type of array that uses named keys instead of numeric ones. This provides a more human-readable way to store data where each value can be accessed by its corresponding string key. An example of an associative array could be storing names as keys and their corresponding ages as values. Here's a brief example: ```php -$ages = array( +$ages = [ "Peter" => 35, "John" => 42, "Mary" => 27 -); +]; ``` In this case, to find out John's age, you would simply use `echo $ages['John']` where 'John' is the key. Associative arrays are also easy to loop through using the `foreach` construct. Visit the following resources to learn more: -- [@official@PHP Documentation - Associative Arrays](https://www.php.net/manual/en/language.types.array.php) \ No newline at end of file +- [@official@PHP Documentation - Associative Arrays](https://www.php.net/manual/en/language.types.array.php) diff --git a/src/data/roadmaps/php/content/indexed-arrays@j2S8dP3HlAOOoZdpj-7Dx.md b/src/data/roadmaps/php/content/indexed-arrays@j2S8dP3HlAOOoZdpj-7Dx.md index 6191918c4..5b1b3c830 100644 --- a/src/data/roadmaps/php/content/indexed-arrays@j2S8dP3HlAOOoZdpj-7Dx.md +++ b/src/data/roadmaps/php/content/indexed-arrays@j2S8dP3HlAOOoZdpj-7Dx.md @@ -5,10 +5,10 @@ Indexed arrays in PHP store values that are accessed through numerical indexes, Here's an Example: ```php -$books = array("The Great Gatsby", "Moby Dick", "To Kill a Mockingbird"); +$books = ["The Great Gatsby", "Moby Dick", "To Kill a Mockingbird"]; echo $books[0]; //Outputs "The Great Gatsby" ``` Visit the following resources to learn more: -- [@official@Indexed Arrays](https://www.php.net/manual/en/language.types.array.php) \ No newline at end of file +- [@official@Indexed Arrays](https://www.php.net/manual/en/language.types.array.php) diff --git a/src/data/roadmaps/php/content/multi-dimensional-arrays@uARTOZ-ZwugSmbCJoRS5Y.md b/src/data/roadmaps/php/content/multi-dimensional-arrays@uARTOZ-ZwugSmbCJoRS5Y.md index ddaf91216..490a0ae6b 100644 --- a/src/data/roadmaps/php/content/multi-dimensional-arrays@uARTOZ-ZwugSmbCJoRS5Y.md +++ b/src/data/roadmaps/php/content/multi-dimensional-arrays@uARTOZ-ZwugSmbCJoRS5Y.md @@ -1,17 +1,17 @@ # Multi-dimensional Arrays -Multi-dimensional arrays in PHP are a type of array that contains one or more arrays. Essentially, it's an array of arrays. This allows you to store data in a structured manner, much like a table or a matrix. The fundamental idea is that each array value can, in turn, be another array. For instance, you can store information about various users, where each user (a primary array element) contains several details about them (in a secondary array like email, username etc.). +Multi-dimensional arrays in PHP are a type of array that contains one or more arrays. Essentially, it's an array of arrays. This allows you to store data in a structured manner, much like a table or a matrix. The fundamental idea is that each array value can, in turn, be another array. For instance, you can store information about various users, where each user (a primary array element) contains several details about them (in a secondary array like email, username etc.). Here's an example: ```php -$users = array( - array("John", "john@example.com", "john123"), - array("Jane", "jane@example.com", "jane123"), - array("Doe", "doe@example.com", "doe123") -); +$users = [ + ["John", "john@example.com", "john123"], + ["Jane", "jane@example.com", "jane123"], + ["Doe", "doe@example.com", "doe123"] +]; ``` Visit the following resources to learn more: -- [@official@Multi-dimensional Arrays](https://www.php.net/manual/en/language.types.array.php) \ No newline at end of file +- [@official@Multi-dimensional Arrays](https://www.php.net/manual/en/language.types.array.php)