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... Link to comment https://forums.phpfreaks.com/topic/17509-numbers/ 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 Link to comment https://forums.phpfreaks.com/topic/17509-numbers/#findComment-74469 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 ... Link to comment https://forums.phpfreaks.com/topic/17509-numbers/#findComment-74470 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 Link to comment https://forums.phpfreaks.com/topic/17509-numbers/#findComment-74474 Share on other sites More sharing options...
brown2005 Posted August 14, 2006 Author Share Posted August 14, 2006 cheers mate works fine.. Link to comment https://forums.phpfreaks.com/topic/17509-numbers/#findComment-74479 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? Link to comment https://forums.phpfreaks.com/topic/17509-numbers/#findComment-74480 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 Link to comment https://forums.phpfreaks.com/topic/17509-numbers/#findComment-74483 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.