I've noticed something interesting about PHP's glob function.
When I do
$directories = glob('*', GLOB_ONLYDIR);
echo json_encode($directories);
the function will return a bunch of folders's names in a json array, great!
But when I do
$directories = glob('./img/works/*', GLOB_ONLYDIR);
echo json_encode($directories);
the function will return a bunch of folder's names with the path like ones shown below:
[".\/img\/works\/123",
".\/img\/works\/234",
".\/img\/works\/345",
".\/img\/works\/456"]
Is this normal? If it is, how can I get the glob function to output only the names of the folders?
A relevant question will be: Is there a way to use GLOB_NOESCAPE GLOB_ONLYDIR flags at the same time when calling the glob function?