1

Can someone check my code, I don't know what's wrong with it. Whenever I execute the code, I get that error in the title.

<?php
$file = "newfile.txt";

$text = "This is a text line. ";

$handle = fopen($file, "w");

fwrite($handle, $text);
fclose($handle);

$handle = fopen($file, "a");

$text = "Here are more text lines to insert."
fwrite($handle, $text);
fclose($handle);

include ($file);

?>
1
  • 1
    I did the same mistake and luckily found this question here ;) +1 from myside. Commented Aug 6, 2022 at 10:11

1 Answer 1

7

You forgot a ; right after this line:

$text = "Here are more text lines to insert."

This will fix your problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.