Skip to content

Instantly share code, notes, and snippets.

@oppara
Created June 18, 2009 23:13
Show Gist options
  • Save oppara/132274 to your computer and use it in GitHub Desktop.
Save oppara/132274 to your computer and use it in GitHub Desktop.
php: mb_trim
function mb_trim( $str ) {
return mb_ereg_replace(
'^[[:space:]]*([\s\S]*?)[[:space:]]*$', '\1', $str );
}
@sandacn
Copy link

sandacn commented Sep 4, 2017

this one faster than above

return mb_ereg_replace(
	'^[[:space:]]*([\s\S]*\S)?[[:space:]]*$', '\1', $str );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment