note 23264 added to function.preg-replace
| From: | hweb8231 at mail dot usyd dot edu dot au | Date: | Sat, 13 Jul 2002 06:06:58 +0000 |
| Subject: | note 23264 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33016@lists.php.net to get a copy of this message | ||
This took me a little while to figure out, even though it's quite simple.
If you want to break up a string by each character, you can use this:
<?php
$num = "12345";
print preg_replace("/(\d)/", "<img src='numbers/$1.gif'>",
$num);
This would output the image code with 1, 2, 3, 4 & 5 replacing $1 for each case.
Hope this helps!
--
http://www.php.net/manual/en/function.preg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+23264
http://master.php.net/manage/user-notes.php?action=delete+23264
http://master.php.net/manage/user-notes.php?action=reject+23264