This little snippet will teach you all about arrays and arrays of arrays, and so on and so forth.
Array Example
LastMitch commented: Thanks for sharing! +12
<?php
$foo = array('1' => 'Hello, World!'
'2' => 'PHP is the best!'
'var' => '');
$foo['var'] = array('1' => 'foo', '2' => 'bar');
//Simple, no? Now...how do we call them?
echo $foo['1'];
// Output: Hello, World!
$i = '2';
echo $foo[$i];
// Output: PHP is the best!
echo $foo['var']['1'] . $foo['var']['2'];
// Ouput: foobar
// I hope this cleared up a lot about arrays for
// you, and how useful they can be, especially
// with a for(); or while(); statement!
?>
LastMitch
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.