fork download
  1. <?php
  2.  
  3. function convertNumber($val)
  4. {
  5. return floatval(preg_replace('/([,])+/','.', $val));
  6. }
  7.  
  8. $val = '0,2';
  9. echo convertNumber($val);
  10.  
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
0.2