cordoprod Posted July 19, 2008 Share Posted July 19, 2008 Hello.. I have a timestamp.. let's say i output it from date("d/m/Y", $timestamp) If that is 19/07/2008 i want to display 1 as 1.jpg and 9 as 9.jpg and / as some image.. All the numbers seperatly as an image.. if you understand.. is that possible? Quote Link to comment https://forums.phpfreaks.com/topic/115628-solved-output-numbers-in-images/ Share on other sites More sharing options...
wildteen88 Posted July 19, 2008 Share Posted July 19, 2008 $date = '19/07/2008'; $chars= str_split($date); foreach($chars as $char) { if(is_numeric($char) echo '<img src="' . $char . '.jpg" />'; elseif($char == '/') echo '<img src="slash.jpg" />'; } Quote Link to comment https://forums.phpfreaks.com/topic/115628-solved-output-numbers-in-images/#findComment-594409 Share on other sites More sharing options...
cordoprod Posted July 19, 2008 Author Share Posted July 19, 2008 $date = '19/07/2008'; $chars= str_split($date); foreach($chars as $char) { if(is_numeric($char) echo '<img src="' . $char . '.jpg" />'; elseif($char == '/') echo '<img src="slash.jpg" />'; } Thank you... is_numeric.. if it is alphabetic letters which function should i use there then? Quote Link to comment https://forums.phpfreaks.com/topic/115628-solved-output-numbers-in-images/#findComment-594410 Share on other sites More sharing options...
.josh Posted July 19, 2008 Share Posted July 19, 2008 well you only specified with numbers. If it could be anything just move the condition for / up and remove the elseif: $date = '19/07/2008'; $chars= str_split($date); foreach ($chars as $char) { if($char == '/') { echo '<img src="slash.jpg" />'; } else { echo '<img src="' . $char . '.jpg" />'; } Quote Link to comment https://forums.phpfreaks.com/topic/115628-solved-output-numbers-in-images/#findComment-594429 Share on other sites More sharing options...
cordoprod Posted July 19, 2008 Author Share Posted July 19, 2008 thanks Quote Link to comment https://forums.phpfreaks.com/topic/115628-solved-output-numbers-in-images/#findComment-594432 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.