note 95640 added to function.str-replace

From: Date: Wed, 13 Jan 2010 17:04:44 +0000
Subject: note 95640 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-164934@lists.php.net to get a copy of this message
@Wes Foster ...or you could use strtr() <?php $replace = array( 'dog' => 'cat', 'apple' => 'orange' 'chevy' => 'ford' ); $string = 'I like to eat an apple with my dog in my chevy'; echo strtr($string,$replace); // Echo: I like to eat an orange with my cat in my ford ?> ---- Server IP: 213.249.64.162 Probable Submitter: 62.163.112.220 ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- https://master.php.net/note/edit/95640 Del: integrated -- https://master.php.net/note/delete/95640/integrated Del: useless -- https://master.php.net/note/delete/95640/useless Del: bad code -- https://master.php.net/note/delete/95640/bad+code Del: spam -- https://master.php.net/note/delete/95640/spam Del: non-english -- https://master.php.net/note/delete/95640/non-english Del: in docs -- https://master.php.net/note/delete/95640/in+docs Del: other reasons-- https://master.php.net/note/delete/95640 Reject -- https://master.php.net/note/reject/95640 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164934) next »