I am writing my first PHP site. I have specified 10 peoples names in 10 variables like this:
$guestName1==“Gary”
$guestName2==“Kevin”
$guestName3==“Steve”
…and so on up to $guestName10.
I need to write a small script which exports the following text:
Dear Gary
Dear Kevin
Dear Steve
…and so on up to the 10th name.
This is the code i’ve been using but it doesn’t work. How can I do it?
$guestName1=="Gary"
$guestName2=="Kevin"
$guestName3=="Steve"
for ($i = 1; $i <= 10; $i++) {
echo ("Dear $guestName[$i]");
}