NEWS: Total Picture Views: 147060 | Total Article Views: 155606 | Top 5 Most Popular Article: 1. Am I Stuck Algorithm with Becker Robot | 2. How to read a JSON and work with it | 3. PickUpThings with Becker Robot | 4. Encrypted Data GUI (Download .Zip) | 5. Create Wall and Things with Becker

Arrays Example with For Loop PHP/MySQL

Description:

In this example I will be showing how to use arrays with a for loop.

Example: https://www.jmdev.ca/sheridan/example/1/

Code:

//Creating the array
$arrays = array();

//Creating variable $x
$x = 0;

//Adding the value into the array $arrays
for($i = 0; $i<10;$i++){
    $x++;
    $arrays[$i] = ($x * $i);
}

//Printing the array
for($i = 0; $i<10;$i++){
    echo ($i+1) . ". " . $arrays[$i] . "<br>";
}

//Looking at the size of the array
echo "<br> Size of the array: " . sizeof($arrays);
Attachments: None

Tags: For loop Arrays Size Array Size

Total Views: 783

My name is Jean-Mathieu

I created this website so other people could enjoy finding useful stuff easier. If you have any question do not hesitate to contact me.

jean8mathieuCreated on 12/18/14


affiliate_link

Disclosure: We are a website that needs compensation to operate like any other website on the internet.
We may receive consideration for our reviews but we are totally unbiased and do not accept paid reviews or fake reviews claiming to be something they are not.