Skip to content
Advertisement

Is there a way for PHP to check if there is a number behind the

Is there a way for PHP to check if there is an number after the . in a variable? for example: $x=4.5 and now i want PHP to check if its a round number or one with a number after the . like shown in $x. I made a script where i want PHP to devide my Variale by 2 and then check if the variable is now round or has a decimal space.

JavaScript

Advertisement

Answer

The modulo operator will tell you if a number is evenly divisible by another.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement