Display images depending on PHP $var

Hi, i have a set of images 0-9 and i need to display a number using them, the number is in a variable.

So say the number is 75029 it would display 7.jpg5.jpg0.jpg etc… etc…

Do any of you php gurus here know how i’d go about doing this. I’m ok with PHP but haven’t done this before. I’m not expecting it to be totally written for me, i’d just like a few pointers.

Thanks

You can use str_split (length of 1) to split the variable into an array. http://us3.php.net/manual/en/function.str-split.php

You can then loop through the array to get the value and then append the .jpg to the end of it.

[code]$var = 75209;
$arry = str_split($var, 1);

for ($i = 0; $i <= count($ary); $i ++) {
echo ‘’;
}
[/code]

Sponsor our Newsletter | Privacy Policy | Terms of Service