Jump to content

Warning: stristr() [function.stristr]: Empty delimiter


prw

Recommended Posts

I keep get the following warning whilst using the following function which I wrote. Is there a way of getting rid of the warning?

 

I'm aware I can just turn off error_reporting to not see the warning, but just wondering if there's a way of fixing it.

 

function contains($value, $a, $b = '', $c = '') {

if (isset($b) && isset($c)) {
	if (stristr($value, $a) || stristr($value, $b) || stristr($value, $c))
		return true;

} elseif (isset($b)) {
	if (stristr($value, $a) || stristr($value, $b)) 
		return true;

} else {
	if (stristr($value, $a))
		return true;
	else
		return false;
}
}

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.