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
https://forums.phpfreaks.com/topic/29965-stristr-weirdness/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.