php Create a script that displays 1-2-3-4-
5-6-7-8-9-10 on one line. There will be no
hyphen(-) at starting and ending position.


<?php

for($i=1;$i<=10;$i++)

{
if($i<=9)
{
echo $i."-";
}
else
{
echo $i;
}
}
?>

output:-
1-2-3-4-5-6-7-8-9-10

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post