<?php
$palavras = explode(' ', 'José da Silva');
echo $palavras[count($palavras) - 1];
$texto = ' José da Silva ';
$texto = trim($texto);
echo substr($texto, strrpos($texto, ' ') + 1);
//https://pt.stackoverflow.com/q/320784/101
PD9waHAKJHBhbGF2cmFzID0gZXhwbG9kZSgnICcsICdKb3PDqSBkYSBTaWx2YScpOwplY2hvICRwYWxhdnJhc1tjb3VudCgkcGFsYXZyYXMpIC0gMV07CgokdGV4dG8gPSAnIEpvc8OpICBkYSAgIFNpbHZhICAgJzsKJHRleHRvID0gdHJpbSgkdGV4dG8pOwplY2hvIHN1YnN0cigkdGV4dG8sIHN0cnJwb3MoJHRleHRvLCAnICcpICsgMSk7CgovL2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8zMjA3ODQvMTAx