PHP learning Free online about

Learn about PHP arrays Lesson 11 Tutorials PHP

11. Arrays in PHP development. Use arrays in PHP coding

11. Arrays in PHP

Arrays are a data format that can help you store multiple values within one verifiable. Arrays are structured to have an identifying key which would then contain value. SO instead of having a bunch of variables you can have them all in one place in an array. By default the keys are numeric and incremental so the first element in the array would go to zero then one then two and so on. You can also assign values to specific keys and use specific key names in an array.

As a numerically indexed array you can add values like in the example below.

PHP Code example


echo myArray[1]; PHP output display B The array gets values assigned to its keys, then you can call the array name and display the value from the array key. Using arrays you can also assign a key value then a value to that key. myArray["A"]="A"; myArray["B"]="B"; myArray["C"]="C"; echo myArray["A"]; PHP output display A

Do Not Sell My Personal Information