Jump to content


Photo

numbers


  • Please log in to reply
6 replies to this topic

#1 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 14 August 2006 - 01:43 PM

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...

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 14 August 2006 - 01:49 PM

<img src="<?php echo 'image'.$a.'.png' ?>">


If that's what you ment? or did you want it to be random?

Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 14 August 2006 - 01:53 PM

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 ...

#4 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 14 August 2006 - 02:06 PM

<?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;
?>
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
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#5 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 14 August 2006 - 02:13 PM

cheers mate works fine..

#6 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 14 August 2006 - 02:14 PM

lol why wat u use now then?

#7 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 14 August 2006 - 02:17 PM

nothing lol just plain text :) did play with GD too at one point
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users