Jump to content

need a little help here!!!


wiegs

Recommended Posts

Something like this should work:

[code]$s = "test2345.gif";

function getnumbers($str) {
    $ret = "";
    for ($i = 0; $i <= strlen($str); $i++) {
        if (is_numeric($str{$i})) {
            $ret .= $str{$i};
        }
    }
    return $ret;
}

echo getnumbers($s);[/code]
Link to comment
Share on other sites

[!--quoteo(post=355806:date=Mar 16 2006, 09:50 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 16 2006, 09:50 PM) [snapback]355806[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Something like this should work:

[code]$s = "test2345.gif";

function getnumbers($str) {
    $ret = "";
    for ($i = 0; $i <= strlen($str); $i++) {
        if (is_numeric($str{$i})) {
            $ret .= $str{$i};
        }
    }
    return $ret;
}

echo getnumbers($s);[/code]
[/quote]


this worked great. thanks!
Link to comment
Share on other sites

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.