note 96961 added to function.preg-replace

From: Date: Thu, 25 Mar 2010 08:00:27 +0000
Subject: note 96961 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-167375@lists.php.net to get a copy of this message
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. ---- Server IP: 195.54.192.44 Probable Submitter: 127.0.0.1 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- https://master.php.net/note/edit/96961 Del: integrated -- https://master.php.net/note/delete/96961/integrated Del: useless -- https://master.php.net/note/delete/96961/useless Del: bad code -- https://master.php.net/note/delete/96961/bad+code Del: spam -- https://master.php.net/note/delete/96961/spam Del: non-english -- https://master.php.net/note/delete/96961/non-english Del: in docs -- https://master.php.net/note/delete/96961/in+docs Del: other reasons-- https://master.php.net/note/delete/96961 Reject -- https://master.php.net/note/reject/96961 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167375) next »