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