add two numbers as string in php

PHP
$num = "3.14";
$int = (int)$num;
$float = (float)$num;
Source

Also in PHP: