I have a path that I want to check for in a url. How would I isolate
‘pages/morepages/’
http://www.mypage.com/pages/morepages/
I’ve tried running a parse url function on my url and then I get the path. I don’t know how to access that key in that array though. For example..
$url = 'http://www.mypage.com/pages/morepages/';
print_r(parse_url($url));
if ($url['path'] == '/pages/morepages/') {
echo 'This works.';
};
I want to run an if conditional on if that path exists, but I am having trouble accessing it.
If you’re just looking for one string within another,
strpos()will work pretty well.