NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
syntax errors in class.


Joined: 15 Aug 2006
Posts: 2
Reply with quote
Whenever I create a class and use a keyword such as "private", "public" or "protected" in front of a variable the IDE indicates that I have made asyntax error by placing a red squiggly line under the keyword. However, the code runs without problems. It's very irritating.

Example

Code:
class Example
{
    //class variables
    protected $var1=2; // the keyword "protected" shows up in the IDE with a squiggly red line underneath.
    private $var2=8;

         
    //function to gather two numbers
    function multiply_numbers()
    {
        $number3 = $this->var1 * $this->var2;
        return($number3);
    }
         
    //function to add numbers together
    function add_numbers()
    {
        echo $this->var1 + $this->var2;
    }       
}
View user's profileFind all posts by MerMerSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
There is nothing wrong with IDE. According to PHP v4 syntax, "protected", "private" and "public" are not supported and IDE tells you so.
If you are developing php5, you have to use appropriate file extension listed in the list for PHP5 (see Tools->Settings->File Associations)
BTW, during installation you were asked if you want php4 or php5 or both installed and which one to be associated with .php extension if both are selected Smile
View user's profileFind all posts by dmitriSend private messageVisit poster's website
syntax errors in class.
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic