how to convert php variable string to int -


how convert string variable integer

2, 990.00 

i want output this

2990.00 

if add 2 numbers

$num1 = '2, 990.00'; <br> $num2 = '7, 990.00'; <br>  <br><br>  $ans = $num1 + $num2;<br>  echo $ans; 

answers 9

you can use preg_replace("/[^0-9.]/", "", $subject) eliminate non-numeric characters.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -