I am currently trying to extract a numeric value from an html string. I am currently using preg_match
but to no luck. All I desire is to get the numeric value set as param of a javascript function myFunction
. As of now I get an empty array. Any help to achieve this?
$data = "<th style='text-align:center;width:33%;'><a onclick='return myfunction(12314568);' href='#test' class='btn mini full'>Test</a> </th>";
preg_match("/\[return myfunction([0-9]+)\]/", $data, $m);
print_r($m);