note 109554 added to function.str-replace

From: Date: Fri, 27 Jul 2012 17:28:10 +0000
Subject: note 109554 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-189434@lists.php.net to get a copy of this message
My previous not about str_replace_limit() (http://www.php.net/manual/en/function.str-replace.php#109365) has a bug in the code at the beginning of the function. The corrected snippet: <?php function str_replace_limit($search, $replace, $subject, &$count, $limit = -1){ $count = 0; // Invalid $limit provided if(!($limit===strval(intval(strval($limit))))){ trigger_error('Invalid $limit '.$limit.' provided. Expecting an '. 'integer', E_USER_WARNING); return $subject; } // Invalid $limit provided /* ... */ ?> A more documented (and bug-free) version can also be found at http://stackoverflow.com/a/11400172/526741 ---- Server IP: 69.147.83.197 Probable Submitter: 97.83.101.136 ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- https://master.php.net/note/edit/109554 Del: integrated -- https://master.php.net/note/delete/109554/integrated Del: useless -- https://master.php.net/note/delete/109554/useless Del: bad code -- https://master.php.net/note/delete/109554/bad+code Del: spam -- https://master.php.net/note/delete/109554/spam Del: non-english -- https://master.php.net/note/delete/109554/non-english Del: in docs -- https://master.php.net/note/delete/109554/in+docs Del: other reasons-- https://master.php.net/note/delete/109554 Reject -- https://master.php.net/note/reject/109554 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189434) next »