/public_html/reviews/index.php
./public_html/reviews/
.$re = '/(.*)\/.*/m';
$str = '/public_html/reviews/index.php';
$subst = '$1';
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
$str = '/public_html/reviews/index.php';
var_export(pathinfo($str));