$cadena="Texto de prueba\nESTO DE AQUÍ NO DEBERÍA ENTRAR.\nESTO TAMPOCO"; $texto=strrev(strrchr("\n",strrev($cadena))); echo $texto;