I am trying to write all values from array into a folder that I created. Here is my code:
     $dir = "images-folder/";
$new_array[] = array($row[0],$row[1],implode($url_array,','));
$files=$url_array;
foreach($files as $file){
    if (!file_exists($dir.$file)) {   
        file_put_contents($dir.$file, var_export($url_array, true));
    }
    else{
        continue;
    }
I got this error:
file_put_contents. failed to open stream.
The array is read fine and I used  var_export  to convert the array to a string, but still I am wondering why the file is not saved in the folder. Is there a way to use different logic here or convert the array in other way
