note 96961 deleted from function.preg-replace by danbrown

From: Date: Thu, 25 Mar 2010 15:51:15 +0000
Subject: note 96961 deleted from function.preg-replace by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-167401@lists.php.net to get a copy of this message
Note Submitter: ugod at yandex dot ru ---- function strautolength ($String, $Format="$1\r\n", $Maxlen=75){ return preg_replace("/(.{0,$Maxlen}(\s+|$))/m",$Format,trim($String)); } example: print strautolength('The string or an array with strings to replace. If this parameter is a string and the pattern parameter is an array, all patterns will be replaced by that string. If both pattern and replacement parameters are arrays, each pattern will be replaced by the replacement counterpart. If there are fewer elements in the replacement array than in the pattern array, any extra pattern s will be replaced by an empty string.'); will output: The string or an array with strings to replace. If this parameter is a string and the pattern parameter is an array, all patterns will be replaced by that string. If both pattern and replacement parameters are arrays, each pattern will be replaced by the replacement counterpart. If there are fewer elements in the replacement array than in the pattern array, any extra pattern s will be replaced by an empty string.

« previous php.notes (#167401) next »