Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialShari Staten
11,540 PointsI don't understand the error I'm getting here...
The error I'm getting is: Bummer: syntax error, unexpected '22' (T_LNUMBER) in fish.php on line 12. Can someone please point out what I'm doing wrong here? I corrected the double quotes and still I get the same error.
<?php
class Fish {
public $common_name;
public $flavor;
public $record_weight;
}
$bass = new Fish();
$bass->common_name = "Largemouth Bass";
$bass->flavor = "Excellent';
$bass->record = "22 pounds, 5 ounces";
?>
1 Answer
Eric Butler
33,512 PointsThis is a good example of how sometimes errors can be misleading. Take a look at the line above line 12, because that's actually where the error is. You've written:
$bass->flavor = "Excellent';
You've started the value with a double-quote but ended it with a single-quote, which means the string is still open. PHP keeps evaluating until it gets to something it can't figure out, on the next line, where you finally close the double-quote with what you thought was a new double-quote. So that's when PHP throws the error. Errors can sometimes be confusing.
Close your double-quote in line 11 and all should be well.