<?php $data = array( 'http://example.com/foo/bar.php?name=test', 'http://example.com/foo/bar.php', '/foo/bar.php?name=test', '/foo/bar.php', ); foreach($data as $url){ var_dump(explode('?', $url, 2)[0]); }
You have javascript disabled. You will not be able to edit any code.