Jump to content

Archived

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

abs0lut

check if the number has decimal(.)

Recommended Posts

can we see your code to test it

you could just use

if(strpos($number,".") !== false){
    echo "is decimal";
}else{
    echo "not a decimal";
}

 

Scott.

 

Share this post


Link to post
Share on other sites

Does not equal exacty... for example

 

<pre><?php

var_dump( TRUE != 1 );

var_dump( TRUE !== 1 );

// also

var_dump( TRUE == 1 );

var_dump( TRUE === 1 );

?></pre>

Share this post


Link to post
Share on other sites

strpos() could return 0 if the string you are looking for is at the start and false will == 0

but if you say === it check the value and the data type. for false it is  boolean and the value is 0

true is boolean and a value of 1

 

Scott.

Share this post


Link to post
Share on other sites

does number 5.00 has decimal?

Share this post


Link to post
Share on other sites

×
×
  • 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.