get file directory and open a file in PHP

function GetFileDir($php_self){
$filename = explode("/", $php_self); // THIS WILL BREAK DOWN THE PATH INTO AN ARRAY
for( $i = 0; $i < (count($filename) - 1); ++$i ) {
$filename2 .= $filename[$i].'/';
}
return $filename2;
}
echo GetFileDir($_SERVER['PHP_SELF']);
?>
http://www.wallpaperama.com/forums/how-to-get-directory-path-only-without-file-name-in-php-t5814.html


$pos = strpos($haystack,$needle);
if($pos === false) {
// string needle NOT found in haystack
}
else {
// string needle found in haystack
}
?>

http://www.maxi-pedia.com/string+contains+substring+PHP