Networking, Programming and Graphics - Tutorials
ONLINEHOWTO.net Tutorials Category

Working with PHP Arrays

Type: Code Networking, Programming and Graphics - Tutorials
Networking, Programming and Graphics - Tutorials
Level: Beginner Networking, Programming and Graphics - Tutorials 
Networking, Programming and Graphics - Tutorials
Date: 2007-Mar-07
Networking, Programming and Graphics - Tutorials
Visited: 2593 times
Networking, Programming and Graphics - Tutorials
Rating: Networking, Programming and Graphics - Tutorials
Networking, Programming and Graphics - Tutorials
Published: Ivory Morhuld

This tutorial will show you how to work with arrays in PHP.

To create an array in PHP use the fowling code:
<?php
$array 
= array();
?>
Each array have one or more elements. Each element have key and value. Values can be arrays too.

Also when you define your array you can fill elements with values like shown in this example. Here the keys are: item, color and size and respective values for this keys are: ball, red and 20.
<?php
$array 
= array('item'=>'ball''color'=>'red''size'=>20);
?>
You can use print_r() function to dump the array
Array
(
    [item] => ball
    [color] => red
    [size] => 20
)
Rate this tutorial:                    
Post Comment

Need a specific tutorial? Do not hesitate and submit a request!
Your e-mail: