brown2005 Posted August 14, 2006 Share Posted August 14, 2006 say i have$a = "544";what i want is to use an image for each number so the 5 would be image5.png and the four image4.png....but how do i create a function that automatically switches the numbers into images... Quote Link to comment Share on other sites More sharing options...
shocker-z Posted August 14, 2006 Share Posted August 14, 2006 <img src="<?php echo 'image'.$a.'.png' ?>">If that's what you ment? or did you want it to be random?Liam Quote Link to comment Share on other sites More sharing options...
brown2005 Posted August 14, 2006 Author Share Posted August 14, 2006 i mean....i want it to break the 544 down.... so it has an image for each individual number so i only have to have images of number 0-9 ... Quote Link to comment Share on other sites More sharing options...
shocker-z Posted August 14, 2006 Share Posted August 14, 2006 [code]<?php$a='544';$numbers=array('1','2','3','4','5','6','7','8','9','0');$images=array('<img src="image1.png">','<img src="image2.png">','<img src="image3.png">','<img src="image4.png">','<img src="image5.png">','<img src="image6.png">','<img src="image7.png">','<img src="image8.png">','<img src="image9.png">','<img src="image0.png">');$b=str_replace($numbers,$images,$a);echo $b;?>[/code]Tested and working :)Take it your using it for counter or date and time or somthing? I use to use the same for a counter back in the day :)Liam Quote Link to comment Share on other sites More sharing options...
brown2005 Posted August 14, 2006 Author Share Posted August 14, 2006 cheers mate works fine.. Quote Link to comment Share on other sites More sharing options...
brown2005 Posted August 14, 2006 Author Share Posted August 14, 2006 lol why wat u use now then? Quote Link to comment Share on other sites More sharing options...
shocker-z Posted August 14, 2006 Share Posted August 14, 2006 nothing lol just plain text :) did play with GD too at one point Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.