0% found this document useful (0 votes)
53 views

PHP Tizag Tutorial-48 PDF

An array called $employeeAges stores the names and ages of employees. Lisa is 28, Jack is 16, Ryan is 35, Rachel is 46, and Grace is 34. A foreach loop iterates through the array and echoes each name and age.

Uploaded by

Anil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

PHP Tizag Tutorial-48 PDF

An array called $employeeAges stores the names and ages of employees. Lisa is 28, Jack is 16, Ryan is 35, Rachel is 46, and Grace is 34. A foreach loop iterates through the array and echoes each name and age.

Uploaded by

Anil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

PHP Code:

$employeeAges;
$employeeAges["Lisa"] = "28";
$employeeAges["Jack"] = "16";
$employeeAges["Ryan"] = "35";
$employeeAges["Rachel"] = "46";
$employeeAges["Grace"] = "34";

foreach( $employeeAges as $name => $age){


echo "Name: $name, Age: $age <br />";
}

Display:
Name: Lisa, Age: 28
Name: Jack, Age: 16
Name: Ryan, Age: 35
Name: Rachel, Age: 46
Name: Grace, Age: 34

You might also like