Parsing error with variable declared outside of function
<p>I'm writing a simple class that will create a simple log file for my site. For some reason, when I have variable file_path outside of the function, I get this error...</p>

<pre><code>Parse error: parse error, expecting `','' or `';''
</code></pre>

<p>With this code..</p>

<pre><code>class Logger {

public $file_path = SITE_ROOT.DS.'logs'.DS.'log.txt';

public static function log_action ($message="") {
    if (file_exists($file_path)) {
        file_put_contents($file_path, $message, FILE_APPEND);
    } else {
        return "could not write to log file";
    }
}
</code></pre>

<p>However when the variable is within the function, this error doesn't come. Why is this?</p>

<pre><code>public static function log_action ($action, $message="") {
    $file_path = SITE_ROOT.DS.'logs'.DS.'log.txt';
    if (file_exists($file_path)) {
        file_put_contents($file_path, $message, FILE_APPEND);
    } else {
        return "could not write to log file";
    }
</code></pre>
