PHP IF string doesn't contain character then require();?

Joe

New member
Hey guys,

Need a small snippet of code for something I'm working on. I need a PHP IF statement that will check if a COOKIE(); contains a certain character, and if it doesn't find that character, use require(); else do nothing.

Any ideas?
 
if (isset($_COOKIE['Name'],'c')) {
if (!strripos($_COOKIE['Name'],'c')) {
# true condition
require(...);
}
} else {
require(...);
}
$value = (strripos($_COOKIE['Name'],'c') ? $_COOKIE['Name'] : require(...));
 
Back
Top