note 108196 added to function.str-replace

From: Date: Fri, 06 Apr 2012 14:43:14 +0000
Subject: note 108196 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-186994@lists.php.net to get a copy of this message
Maybe obvious to veteran PHP programmers but less so to novice PHP programmers is the fact that this is invalid: <?php str_replace($search, $replace, $subject, 1); ?> At a glance it appears to be a reasonable request, until you realize that the fourth parameter must be a variable in order to be passed as a reference. A replacement: <?php str_replace($search, $replace, $subject, $temp = 1); // or $temp = 1; str_replace($search, $replace, $subject, $temp); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 64.121.17.196 ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- https://master.php.net/note/edit/108196 Del: integrated -- https://master.php.net/note/delete/108196/integrated Del: useless -- https://master.php.net/note/delete/108196/useless Del: bad code -- https://master.php.net/note/delete/108196/bad+code Del: spam -- https://master.php.net/note/delete/108196/spam Del: non-english -- https://master.php.net/note/delete/108196/non-english Del: in docs -- https://master.php.net/note/delete/108196/in+docs Del: other reasons-- https://master.php.net/note/delete/108196 Reject -- https://master.php.net/note/reject/108196 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#186994) next »