ballhogjoni Posted July 10, 2013 Share Posted July 10, 2013 Is there a strict type for decimal? I've done it with int and float. php > $a = (int)1.2; php > echo $a; 1 php > $a = (decimal)1.2; PHP Parse error: parse error in php shell code on line 1 php > $a = (float)1.2; php > echo $a; 1.2 Link to comment https://forums.phpfreaks.com/topic/280038-php-strict-type/ Share on other sites More sharing options...
AbraCadaver Posted July 10, 2013 Share Posted July 10, 2013 There is no "decimal" type in PHP. What are you trying to accomplish? Link to comment https://forums.phpfreaks.com/topic/280038-php-strict-type/#findComment-1440188 Share on other sites More sharing options...
kicken Posted July 10, 2013 Share Posted July 10, 2013 (float) is what you'd use for a decimal number. If your looking for a fixed-point decimal type, there is no such native type in PHP. You would have to implement such a thing yourself with a class. Link to comment https://forums.phpfreaks.com/topic/280038-php-strict-type/#findComment-1440224 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.