Jump to content

Php Problems - Should Be Quick


timothyarden

Recommended Posts

Hi Guys,

I am getting this error,

Parse error: syntax error, unexpected T_VAR in D:\Program Files\XAMPP\htdocs\agg\edit_home_content.php on line 31

(Line 31 is the 2nd line of code)

 

For this code (It is inside a class)

public function edit_home_content(){
           var $content_file = fopen('home_content.xml','r');
           var $previous_content = fgetc(content_file);
           var $values = $values;
           var $values .= $previous_content;
           // add the above to the bottom of the new code
           // then write below
           fclose($content_file);

           var $content_file = fopen('home_content.xml','r+');
           fwrite(content_file,$this -> values);
           fclose(content_file);            
       }

 

Any Suggestions?

 

Thanks in advance

Timothy

Link to comment
https://forums.phpfreaks.com/topic/270520-php-problems-should-be-quick/
Share on other sites

When you define class properties, you can only assign fixed/constant values as part of the declaration. You cannot assign variables, the result of functions... when you define the class properties.

 

Also, the var keyword is php4 syntax. You should be using public, private, or protected

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.