I have a string that is attempting to find specific resources within an API call.
The resources are levels: undergraduate, graduate, independent academic work, and "" (which supposedly means none/unassigned).
So, is simply using strpos($level, "") !== false
acceptable when attempting to find the "" level?
I have it set up like so, but any "" level course is not being rendered:
$section = $course->{'SectionName'};
$level = $course->{'Level'};
$parent = the_parent_title();
if($section === '01' && (
strpos($level, $parent) !== false
|| strpos($level, "") !== false
|| strpos($level, 'Independent Academic Work') !== false
)
)
Any help would be appreciated.
Two double quotes means an empty string.
Use
empty()
function of php.Or use string comparison: