<?php preg_match("/\d/", "1 and 2 and 3 and 4", $matches); echo "Value: " . $matches[0][2] . "\n"; ?>