$num = 500; $str = $substr($texto,$num); $n = strlen($str)-strpos($str," "); $textocortado = substr($str,-$n);