Jump to content

stristr weirdness


ralph4100

Recommended Posts

ok here's the code:
[code]<?php

function checkFor($n)
{
//let's see if this syntax works...
//it's supposed to be true for any variation (regarding capitalization)
//of the word 'reset'
echo 'checking \''.$n.'\'...';
if(stristr('reset',$n)!==false) {
echo 'true';
}
else {
echo 'false';
}
echo '<p>';
}

checkFor('reset');
checkFor('RESET');
checkFor('does not contain ');
checkFor('does contain reset');
checkFor('rEsEt');
checkFor('ReSeT');
checkFor('reeeeset');
?>[/code]

and here's the output

[code]checking 'reset'...true
checking 'RESET'...true
checking 'does not contain '...false
checking 'does contain reset'...false
checking 'rEsEt'...true
checking 'ReSeT'...true
checking 'reeeeset'...false[/code]

stristr() should not return false for 'does contain reset' because 'reset' is in the string 'does contain reset'. get me? what's going on here? running php 5.2 btw...
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.