Jump to content

[SOLVED] If decimal exists then stop looping


KingOfHeart

Recommended Posts

I want to divide a number in php. Then if that number has a decimal I want to stop a while loop. Oviously strpos does not work.

 

while($n < strlen($fileData)) {

	$n++;
	if($num == 0)
	{
		$x = $fileData[$n] / 32;
		if(strpos($x,".") === false)
		{
			echo "X:" . $x . " ";
		}
		else
		{
			echo "stopped";
			return;
		}

	}
	else if($num == 1)
	{
		$y = $fileData[$n] / 32;
		if(strpos($y,".") === false)
		{
			echo "Y:" . $y . " ";
		}
		else
		{
			echo "stopped";
			return;
		}
	}
	echo $fileData[$n] . "<br>";
	$num++;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.