php convert string to decimal code example Example 1: string to decimal php $num = (double) "10.12"; Example 2: php float value floatval ($var)