PHP Array tutorial - Display the array content
In this tutorial I will show you how to work with arrays in PHP. You will learn how to create, sort or print an array. Besides this we will touch on multidimensional arrays as well.
|Name:||PHP Array tutorial|
Bookmark PHP Array tutorial
Step 3 - Display the array content
PHP Array tutorial
In the last step we have created an array. It is not important which sollution you choose the result is the same. It's nice but how you can use the data in the array. For example how to display the elements? There are more ways to do this. Let's see the possibilities.
If you want only display one element of the array then you can just write the following code:
foreach loop as this:
print_r and var_dump. These functions displays tha array as key-value pairs. Besides this var_dump also displays variable informations. You can use them as follows:
In the next step we will learn about associative arrays.
Previous Step of PHP Array tutorialNext Step of PHP Array tutorial
Tags: array, php array, sort array, create array, print array, array length
|PHP Array tutorial - Table of contents|
|Step 1 - Introduction to arrays|
|Step 2 - Creating an array|
|Step 3 - Display the array content|
|Step 4 - Associative arrays|
|Step 5 - Multidimensional arrays|
|Step 6 - Array functions|
|Step 7 - Complete example code|