在PHP和JavaScript中将货币转换为十进制

I'm looking for the shortest/easiest way to achieve this.

var savings = <?php echo $list_price ?> - discount_price;

savings: 1.00

$list_price: '$10.00'; discount_price: '$9.00';

Cheers.

var savings = parseFloat('<?php echo $list_price ?>'.substr(1)) -
  parseFloat(discount_price.substr(1));

This parses the string as a number, skipping the first characters (dollar).

isnt currency by default represented as a "decimal" (of sorts)

$1.00 = 1.00
0.50c = 0.5

Maybe this is the answer?

var savings = parseFloat(<?php echo $list_price ?>) - discount_price;