Set up PHP

In this activity we will look at an array as a data structure in PHP

STEP 1 If you have already downloaded XAMPP skip this step

Down Load Link Click Here ( ignore the service, password and database parts of video )

Create A folder within the htdocs folder as in example below which will store your php programs

Use Notepad++ to create first PHP echo program

Open Notepad++ and copy and paste code PHP below. Save file as array.php. 

<?php   

$names=array("mary","bob","charles");

 for($i=0;$i<3;$i++) {

           print $names[$i]."<br>";

}

?>

Challenge :   Create an array  :   $NumberSort = [0,5,9,6,4,3,2,]

1 Loop thru the array and print out the numbers  and message this array is not sorted 

2 Loop thru the array and find largest and print out the largets number with the message Found largest 

3 Sort the array and then print out the sorted array 

Scroll to Top