I want to loop this code until it prints the last value which is 51 as a single value. when I change starting value (1) and ending value (51 -> 1) to 2 and 4 it works fine.
But if the starting = ending value again this endless loop occurs.
$path = "1/40/51/";
while ($path != "") {
$arr = explode("/", $path);
$value = $arr[0];
echo '</br>';
echo $value;
$path = str_replace($value. '/', '', $path);
echo '</br>';
echo $path;
}
` or `
` or `
` are. – Funk Forty Niner Aug 21 '20 at 18:51