[Solved] To print sum of numbers from this string


you can use this to separate text and number first then proceed further,

preg_match_all('/[^\d]+/', $string, $textMatch);
preg_match('/\d+/', $string, $numMatch);

$text = $textMatch[0];
$num = $numMatch[0];

2

solved To print sum of numbers from this string