NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP Regexs (I presume) help needed

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 02-22-2006, 09:54 AM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Dec 2004
Posts: 30
n0dice is an unknown quantity at this point
 



PHP Regexs (I presume) help needed


Hey all. Basically what I'm trying to do is take a text string generated from form and take each individual alphanumeric character and replace it with the corrosponding image. So if 'cat' is typed in it displays '<img src="c.gif"><img src="a.gif"><img src="t.gif">. The images would be transparent gifs of the corrosponding letter from a specific font. Is this possible and how might i do it? Thanks.
n0dice is offline  
Old 02-22-2006, 12:35 PM   #2 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,963
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
Well you don't really need a regex here...
Basically you need to 'scan' your string one letter at a time - a simple loop will do the job nicely
PHP Code:
<?php

$input_string
=$_POST['your_text_field_name_here']; // => here put the name of the input field as defined in your HTML form
$string_length=strlen($input_string); // check length of input string
if ($string_length ) {
     for (
$count 0$count $string_length; ++$count) {
????: NamePros.com http://www.namepros.com/programming/170106-php-regexs-i-presume-help-needed.html
     echo 
'<img src="'.substr ($input_string$count).'.gif">';
     }
}

?>
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is online now  
Old 02-22-2006, 03:22 PM   #3 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



very clever! well done - have been looking for something like this for a long, long time, and just never thought to use substr. I was stuck trying to find a way to use explode!
Originally Posted by sdsinc
Well you don't really need a regex here...
????: NamePros.com http://www.namepros.com/showthread.php?t=170106
Basically you need to 'scan' your string one letter at a time - a simple loop will do the job nicely
PHP Code:
<?php

$input_string
=$_POST['your_text_field_name_here']; // => here put the name of the input field as defined in your HTML form
$string_length=strlen($input_string); // check length of input string
if ($string_length ) {
     for (
$count 0$count $string_length; ++$count) {
     echo 
'<img src="'.substr ($input_string$count).'.gif">';
     }
}

?>
PoorDoggie is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Great Scripts for Sale With Resale Rights! Zeeble Scripts For Sale 20 01-04-2006 01:39 AM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 09:09 AM

 
All times are GMT -7. The time now is 02:09 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger