- substr: documentation ( source)
- preg_match: documentation ( source)
- md5: documentation ( source)
<?php
$string = '1234 6514 1254 0014';
$string = md5($string);
preg_match('/\d+?/', $string, $matches);
echo substr($matches[0], 0, 1);
printr_r($matches);