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 Quote Link to comment https://forums.phpfreaks.com/topic/280038-php-strict-type/ Share on other sites More sharing options...
Solution AbraCadaver Posted July 10, 2013 Solution Share Posted July 10, 2013 (edited) There is no "decimal" type in PHP. What are you trying to accomplish? Edited July 10, 2013 by AbraCadaver Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/280038-php-strict-type/#findComment-1440224 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.