Hi everyone, I have been using strcmp in a website I am helping with, we use this to check against passwords when a user is resetting thier password.

The problem I have at the moment is, when ever i try to use the strcmp to check against numbers It always says the numbers are incorect.
But I know 100% the numbers I am checking against are correct as I have these echo'd out on the page.

I guess my question would be, is there a different function I need to use when checking if both numbers are correct.

here is the start of how I am checking if both numbers are correct
.

if( strcmp($lastfour, $cnumber) != 0 )

Cheers DM :)

If they are numeric check if they are equal:

if(is_numeric($lastfour) && is_numeric($cnumber) && ($lastfour != $cnumber)) {
    // they are not equal
} elseif(strcmp($lastfour, $cnumber) != 0) {
    // they are not equal
} else {
    // they might be equal
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.