<?php $input = "Sum(1, 5, 7)"; preg_match_all('#(\w+)\((.*?)\)#', $input, $m); print_r($m);
Standard input is empty
Array ( [0] => Array ( [0] => Sum(1, 5, 7) ) [1] => Array ( [0] => Sum ) [2] => Array ( [0] => 1, 5, 7 ) )
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!