PHP Parse error

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


19 points

Hi I am a newbie and my following code is giving me parse error. What am I doing wrong?


<?php

$file 
fopen("words.txt","r")

if(
file_exists("words.txt")) {
echo 
"this is correct";
}
?>

This gives me error.

<?php
PHP Parse error
parse error in file.php on line 2.
?>



-10 points

You are missing semi-color (;):

<?php
$file 
fopen("words.txt","r")
?>

Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.