Jump to content

Recommended Posts

$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" />';
}

$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?

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" />';
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.