rahuul Posted November 17, 2009 Share Posted November 17, 2009 can any one help me.... I have size like "1/2, 1/3, 1/4,......." in data base.(varchar) I want to convert it to float like ".5, .33, .25,......." pls help thanks Link to comment https://forums.phpfreaks.com/topic/181847-solved-convert-string-to-float-help/ Share on other sites More sharing options...
MadTechie Posted November 17, 2009 Share Posted November 17, 2009 2 options, <?php $IN = "1/2"; eval("\$Out = $IN;"); //people don't like eval for security reasons so list($a,$b) = explode("/",$IN); $Out = $a/$b; echo $Out; Link to comment https://forums.phpfreaks.com/topic/181847-solved-convert-string-to-float-help/#findComment-959072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.