note 61298 added to function.str-replace

From: Date: Mon, 30 Jan 2006 17:57:57 +0000
Subject: note 61298 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-102742@lists.php.net to get a copy of this message
Suggested code has some drawbacks in the context of many replacement pairs (i am not suggesting that mine has none). The example code you provided: <?php return str_replace( array('&#262;', '&#263;', '&#264;', [...]), array('&#262;', '&#263;', '&#264;', [...]), strtoupper($string) ) ; ?> relies on the fact that visual identation is provided by all replacement elements beeing of the same width, which is hardly ever true in the real world (please correct me if I'm wrong). Another nasty feature is that this code extends to the right with addition of new elements while the solution provided in the earlier post extends in the driection of the natural flow of code, thus, retaining correct code width for all cases. Perhaps you have ommited the fact that I specifically intended suggested code format for cases with many replacement pairs indicated with /* many lines here */ in the previous post? ---- Server IP: 161.53.30.180 Probable Submitter: 195.245.255.130 ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61298 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61298&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61298&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61298&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61298&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61298&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61298&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61298&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61298&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102742) next »