note 71454 added to function.preg-replace

From: Date: Wed, 29 Nov 2006 22:04:28 +0000
Subject: note 71454 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-120168@lists.php.net to get a copy of this message
To Magikx: You don't need preg_replace to achieve what you want, I'll show you right after, but your error is you forgot to put the subject string at the end, as says the manual, like this: $text=preg_replace('0','<img src=images/num1/0.gif>',$text); Now I said you don't need preg_replace, just look at what you're replacing: numbers and letters, so why not just directly insert them in the img tags, thus saving time, space AND processing: print "<img src=images/num1/". $text .".gif>"; ---- Server IP: 66.207.199.35 Probable Submitter: 69.159.172.40 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- https://master.php.net/note/edit/71454 Del: integrated -- https://master.php.net/note/delete/71454/integrated Del: useless -- https://master.php.net/note/delete/71454/useless Del: bad code -- https://master.php.net/note/delete/71454/bad+code Del: spam -- https://master.php.net/note/delete/71454/spam Del: non-english -- https://master.php.net/note/delete/71454/non-english Del: in docs -- https://master.php.net/note/delete/71454/in+docs Del: other reasons-- https://master.php.net/note/delete/71454 Reject -- https://master.php.net/note/reject/71454 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120168) next »