Hi, I HAVE A variable like Total = $40 Total = €40 Total = GBP 40 How do i remove or concatenate these signs so that total = 40 Regards
<?php $total = "ABC 40 XYZ"; $total= eregi_replace('[^0-9]','',$total); echo $total; //prints 40 ?> PHP:
I would use preg_replace instead of ereg_replace. The ereg_ functions are going to be removed in the next version of php (php6) so it's probably a good idea to stop using them now. Also, you may want to allow a ' . ' in case you have a decimal number.