master82 Posted December 26, 2006 Share Posted December 26, 2006 I have $value that contains a currency value (such as $2.50),I want to change the £2.50 into 250 (ie remove the £ and . )How would I go about this? Link to comment https://forums.phpfreaks.com/topic/31868-remove-decimal-point/ Share on other sites More sharing options...
mynamesleo Posted December 26, 2006 Share Posted December 26, 2006 [code]str_replace("£", "", $value);[/code]I guess that would work, and do the same for the . Link to comment https://forums.phpfreaks.com/topic/31868-remove-decimal-point/#findComment-147875 Share on other sites More sharing options...
ted_chou12 Posted December 26, 2006 Share Posted December 26, 2006 round($number, 0); also works Link to comment https://forums.phpfreaks.com/topic/31868-remove-decimal-point/#findComment-147876 Share on other sites More sharing options...
master82 Posted December 26, 2006 Author Share Posted December 26, 2006 thanks ;D Link to comment https://forums.phpfreaks.com/topic/31868-remove-decimal-point/#findComment-147880 Share on other sites More sharing options...
kenrbnsn Posted December 26, 2006 Share Posted December 26, 2006 If you use the str_replace() method, do it in one call:[code]<?php$value = str_replace(array('£','.'),'',$value);?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/31868-remove-decimal-point/#findComment-147891 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.