More - I went over the post limit.
Arrays
Nearly there! Remember earlier I mentioned a list going in an array? This is how.
An array is simply a list of items. To create an array you do the following:
PHP Code:$worker[0] = "Jack";
$worker[1] = "Ed";
$worker[2] = "Alex";
$worker[3] = "Rob";
This creates a list of items. The variable $worker is now an array. [NOTE: That the first item is not the ‘1st’ but the ‘0th’. To display them, you just echo them like we did above:
PHP Code:echo $worker[0]; //Displays Jack
PHP Code:echo 'One of the workers is called: '.$worker[2].' He is a nice worker'; //Displays: One of the workers is called Alex He is a nice worker.
Happy?
That is indeed the basics of PHP covered as simply as I can put.



LinkBack URL
About LinkBacks




Reply With Quote


Bookmarks