I'm trying to create a folder using mkdir()
in a PHP script.
In the location of file.php
I have a folder named "details". In that folder I want to create another folder.
I use this code:
mkdir("details/$id", 0777, true);
But I always get this warning:
Warning: mkdir(): Invalid argument in C:\Users\Lenovo\xampp\htdocs\public_html\file.php on line 40
I checked that $id
isn't empty by echoing it.
How to create the folder with $id
name under details folder?
You can not use your $id inside the string, you have to concatenate it
mkdir("details/". $id, 0777, true);
OR
mkdir("details/{$id}", 0777, true);