I want to extract numbers from a string in PHP like following :
if the string = \'make1to6\' i would like to extract the numeric charac
You can use regular expressions.
$string = 'make1to6'; if (preg_match('/(\d{1,10})to(\d{1,10})/', $string, $matches)) { $number1 = (int) $matches[1]; $number2 = (int) $matches[2]; } else { // Not found... }