I created a function using fopen in php if i use it as a function it doesnt work if i use it alone it does
<p>Basically i created a some code that creates a file....
I can use that code and works perfectly in the IF statements in my code... now... because i have to use it twice... I decided to make it a function... but as soon as i make it a function it  doesnt work...</p>

<p>anyone can tell me why??
I am just calling the function inside others IF statements as 
<code>if (createFile()) {
 echo "it worked";
}</code></p>

<pre><code>function createFile () {
        //Creates File and populates it.
        $fOpen = fopen($dbFile, 'w');

            $fString .= "&lt;?php\n";
            $fString .= "// Database Constants\n";
            $fString .= "define(\"DB_SERVER\", \"$server\");\n";
            $fString .= "define(\"DB_USER\", \"$username\");\n";
            $fString .= "define(\"DB_PASS\", \"$password\");\n";
            $fString .= "define(\"DB_NAME\", \"$dbname\");\n";
            $fString .= "?&gt;";

        fwrite($fOpen, $fString);
        fclose($fOpen);
}
</code></pre>
