Hello, if I enter only the first part of the code

array_splice($f_arr1, $id, 1); $f1 = fopen("file1.dat", "w"); for($i = 0; $i < count($f_arr1); $i++){ fwrite($f1, $f_arr1[$i]); } close($f1); 

Then the code works, i.e. the line in the file is deleted, but if you add this code below, the second part does not work.

 array_splice($f_arr2, $id, 1); $f2= fopen("../../file2", "w"); for($j = 0; $j < count($f_arr2); $j++){ fwrite($f2, $f_arr2[$j]); } close($f2); 

Will explain, please, errors.

  • And errors are displayed any? Or maybe there is something in the logs? - KryDos
  • No, it does not appear - ivanforpw


1 answer 1

Maybe he $ id redefines?

  • no, $ id is the same there - ivanforpw
  • then did not correctly indicate the path to the file or did not specify the file extension - Lgunchik
  • No, everything is correct, if I delete the first part, the second one works, and if I don’t delete anything, only the first one works. - ivanforpw
  • one
    no close () function ... there is fclose (); - Lgunchik
  • it turned out, thanks - ivanforpw