Simple Array Example Learn PHP Programming Creating Arrays Learn Tutorial


Simple Array Example Learn PHP Programming Creating Arrays Learn Tutorial
  Forums Index
      » PHP Forums
        » » Simple Array Example Learn PHP Programming Creating Arrays Learn Tutorial



Simple Array Example Learn PHP Programming Creating Arrays Learn Tutorial
Post Description:
Post Tags: simple, array, example, learn, php, programming, creating, arrays, learn, tutorial, free php support, php scripts, php questions, php answers, programming, codes, scripts
This Post Has Been Viewed 401 Times Since Sat Mar 31, 2007 4:10 pm Posted By unix with 1 replies
Simple Array Example Learn PHP Programming Creating Arrays Learn Tutorial
Learning arrays was one of the harding part for me to learn when programming in php or any other similar languages like C++. Today i will show you how you can create a simple array and display the array with a for loop so it will display the numbers 0 through 5 on the screen. So this is how i will show you:

1. you will need to have a website with PHP. If you don't have PHP on your website, you can visit our friends at Webune.com They have very good service PHP Hosting.

2. a text editor - If you have windows, you can use notepad.

now copy and paste the following code into your text editor and save it as loop.php



     Code:
<?php
# Create by Wallpaperama.com
#
$numbers = array(0,1,2,3,4,5);

for($counter =0; $counter <= 5; $counter++)
{
echo 'Array'.$counter.' = '.$numbers[$counter].'<BR>';
}

?>


Now open it with your browser and this is what it will show:


     Code:
Array0 = 0
Array1 = 1
Array2 = 2
Array3 = 3
Array4 = 4
Array5 = 5

Leave Your Comments
* Your Name

  * Your Email Address (Will Not Be Published)

* Your Comments


Add Picture To Comments
Yes No             upload
Receive Replies on my Comments
(An email will be sent to you when someone replies to your comments)

     




Comments and replies About Simple Array Example Learn PHP Programming Creating Arrays Learn Tutorial






:: 1 :: #42920 - Reply By Administrator On Sun Feb 24, 2008 12:10 pm
take a look at this tutorial. it helped me alot

how-to-index-arrays-and-show-all-the-elements-and-values-of-array