note 99482 added to ref.mbstring

From: Date: Thu, 19 Aug 2010 14:46:35 +0000
Subject: note 99482 added to ref.mbstring
Groups: php.notes 
Request: Send a blank email to php-notes+get-171847@lists.php.net to get a copy of this message
<?php /** * Multibyte safe version of trim() * Always strips whitespace characters (those equal to \s) * * @author Peter Johnson * @email phpnet@rcpt.at * @param $string The string to trim * @param $chars Optional list of chars to remove from the string ( as per trim() ) * @param $chars_array Optional array of preg_quote'd chars to be removed * @return string */ public static function mb_trim( $string, $chars = "", $chars_array = array() ) { for( $x=0; $x<iconv_strlen( $chars ); $x++ ) $chars_array[] = preg_quote( iconv_substr( $chars, $x, 1 ) ); $encoded_char_list = implode( "|", array_merge( array( "\s","\t","\n","\r", "\0", "\x0B" ), $chars_array ) ); $string = mb_ereg_replace( "^($encoded_char_list)*", "", $string ); $string = mb_ereg_replace( "($encoded_char_list)*$", "", $string ); return $string; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 83.244.132.215 ---- Manual Page -- http://www.php.net/manual/en/ref.mbstring.php Edit -- https://master.php.net/note/edit/99482 Del: integrated -- https://master.php.net/note/delete/99482/integrated Del: useless -- https://master.php.net/note/delete/99482/useless Del: bad code -- https://master.php.net/note/delete/99482/bad+code Del: spam -- https://master.php.net/note/delete/99482/spam Del: non-english -- https://master.php.net/note/delete/99482/non-english Del: in docs -- https://master.php.net/note/delete/99482/in+docs Del: other reasons-- https://master.php.net/note/delete/99482 Reject -- https://master.php.net/note/reject/99482 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#171847) next »