Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Robert Engelbert
7,229 Pointskeep getting an error
I keep getting an error that says Parse error: syntax error, unexpected ';' in /home/treehouse/workspace/inc/functions.php on line 16
<?php
function get_item_html($id,$item) {
$output = "<li><a href='#'><img src='"
. $item["img"] . "' alt='"
. $item["title"] . "'/>"
. "<p>View Detials</p>"
. "</a></li>";
return $output;
}
function array_category($catalog,$category) {
$output = array();
foreach ($catalog as $id => $item) {
if ($category == null OR (strtolower($category) == strtolower($item["category"])){
$sort = $item["title"];
$sort = ltrim($sort,"The ");
$sort = ltrim($sort,"A ");
$sort = ltrim($sort,"An ");
$output[$id] = $sort;
}
}
asort($output);
return array_keys($output);
}
here's line 16
$sort = $item["title"];
I've went over and over this and I can't find anything wrong, any help would be appreciated.
1 Answer

Jennifer Nordell
Treehouse TeacherHey there! You're doing great! Would it be encouraging to know that it's just a runaway parenthesis? It's a good idea when looking at an error to also look at the lines above it. Often that's what is causing the problem. In this case, it's the line immediately above.
It should look like this:
if ($category == null OR strtolower($category) == strtolower($item["category"])) /* note the removal of the open parenthesis between the OR and the strtolower */
Happy coding!
Robert Engelbert
7,229 PointsRobert Engelbert
7,229 PointsJennifer you are awesome! I spent a lot of time looking at that code. Thank you
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherRobert Engelbert You're quite welcome!