This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by Tobias Corompt
about 10 years

7/10 Parse error but I passed ó.Ò

It’s strange. It let’s me pass but it gives me this: Parse error: syntax error, unexpected ';', expecting T_FUNCTION on line 15

My code:

  <?php
            class Dog{
             public $numLegs = 4;
             public $name;
             public function __construct($name) {
                 $this->name = $name;
            }
          ?>

Could you please tell me what I have done wrong? :-)

Answer 52e5119852f863c7f4006fd7

5 votes

Permalink

Correct Solution

<?php
    class Dog  {
        
        public $numLegs = 4;
        public $name;
        
        
       public function __construct($name) {
            $this->name = $name;
            
            }
        }
    ?>
points
Submitted by Zain Ali
about 10 years

2 comments

Tobias Corompt about 10 years

It’s like you said :) I forgot the } at the end ^^ Thanks ;)

Zain Ali about 10 years

You’re welcome. :)

Answer 52e63c25548c35dd89001ada

0 votes

Permalink

I had no problems with the code shown above as it’s identical to mine, with which i got a full pass with no syntax errors, just accept it as correct.

points
Submitted by Daniel Scarborough
about 10 years

Answer 52e7b5af7c82cac31100281c

0 votes

Permalink

Thank you all for your help ;) my error is gone ;D

points
Submitted by Tobias Corompt
about 10 years

Answer 52e2b26b631fe9c2f000095a

-2 votes

Permalink

You did NOTHING! I checked your code and is EXACTLY equal to my code. And i passed with no error. This compiler sometimes is all fckd up xD

points
Submitted by Francisco Kiko
about 10 years