Hello,
I want it to remove slashes at the beginning and end of the directory path. Is this regular expression correct?
$string = "/dir/dir/dir/dir/";
or
$string = "//dir/dir/dir/dir/";
or
$string = "/dir/dir/dir/dir//";
or
$string = "dir/dir/dir/dir/";
or
$string = "/dir/dir/dir/dir";
preg_replace(['/^\/\//','/^\//','/\/*$/'], '', $string);
I want the following output
Output: dir/dir/dir/dir