I want to make a script in PHP which displays the numbers and a hyphen between the numbers. It should look like this:
1-2-3-4-5-6-7-8-9-10
I have the following script right now, but the problem is it displays a hyphen at the end of the numbers:
$x = 1;
$h = 1;
while($x <= 10) {
echo "$x";
$x++;
if($h < $x){
echo "-";
$h++;
}
}
Thanks in advance :)