- preg_match: documentation ( source)
- print_r: documentation ( source)
<?php
$path = 'Nil';
$index = 'surveyandmedia3';
$medianame = preg_match("/surveyandmedia(\d+)$/",$index,$qnumber);
if(count($qnumber) > 0)
$path = $qnumber;
else
$path = $index;
print_r($path[1]);
?>