0
would you please help me out with the following code?
<?php $i = 1; $names = array("Dar", "Sara", "kozet"); foreach ($names as $name) { do { echo "the number $i name is: " . $name . "<br />"; } while ($i <=3); $i++; ?> I want to print names by number under the specific condition. Thank you
3 Answers
+ 4
https://code.sololearn.com/wwEPT230dtwr/#php
<?php
$i = 1;
$names = array("Dar", "Sara", "kozet");
foreach ($names as $name) {
echo "the number $i name is: " . $name . "<br>";
$i++;
}
?>
####OUTPUT####
the number 1 name is: Dar
the number 2 name is: Sara
the number 3 name is: kozet
+ 5
<?php
$names = array("Dar", "Sara", "kozet");
foreach ($names as $i => $name) {
echo "the number $i name is: " . $name . "<br />";
}
?>
+ 2
thank YOU guys :)