-
Noob PHP question!
Hey, A few weeks back i kept coming here to ask for help when i was playing around with a PHP thingy i was doing, now i want to delve even more into PHP, and although ive looked around i cant find anything that will tell me what an array, actually is. They give you examples, but i'd be grateful if anyone can help me on how and when they are used :)
Sorry if its noobish, and dont forget, im only learning :)
thanks for any help (rep :))
-
http://uk.php.net/array - All you need to know about arrays :)
-
-
PHP Code:
<?php
$robbie = array("awesome","amazing","godly","fantastic","superb","wonderful");
foreach($robbie as $value) {
echo 'Robbie is ' . $value . ' and thats a fact';
}
?>
-
Quote:
Originally Posted by
Robbie!
PHP Code:
<?php
$robbie = array("awesome","amazing","godly","fantastic","superb","wonderful");
foreach($robbie as $value) {
echo 'Robbie is ' . $value . ' and thats a fact';
}
?>
Can you explain?
Does that mean like it picks one randomely and echo's Robbie is (either) awesome or amazing etc..
-
-
Arrays are a object in PHP (and most other languages) which store multiple values. You can store these values and and read them in a variety of ways. In Robbie's example, he uses the foreach structure - this goes through each item in the array systematically, and does something with each value.
-
Thanks for the help :) Still dont get it but i appreciate the help and i guess the more i read about it, the more i'll learn :) Picked up some basics though =D
-
-
I actualthink i get the basics of it now :)
Thanks alot, that post above helped alot lol :)