/** * This function will remove all newlines and all spaces at the beginning and end of each line. * * @param $string String to remove the whitespace from. * * @returns The original string without the newlines and spaces at the beginning and end of each line. * * @static */ function removeWhiteSpace($string) { // First, normalize the newlines $string = YDStringUtil::normalizeNewLines($string); // Now, remove the whitespace $string = implode(' ', array_map('trim', explode(YD_CRLF, $string))); // Return the changed string return $string; }