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.

PHP Designing Interfaces in PHP Introducing Interfaces Autoloading

Error in the treehouse code!! I think this is a bug!

I keep getting this error:

Parse error: syntax error, unexpected '$title' (T_VARIABLE) in /home/treehouse/workspace/index.php on line 4

This is a line of code that came preloaded on the workspaces.

I've included all of the files worked with so far index.php


//the line below is in question
$title = "My Website";

require 'views/header.php';

require 'views/footer.php';



function autoloader($class_name) {
  foreach(glob(__DIR__ . '*/', GLOB_ONLYDIR) as $dir) {
    if (file_exists("dir/" . $class_name . '.php')) {
        require_once "dir/" . $class_name . '.php':




class Collection {


2 Answers

Gregor Medvesek
Gregor Medvesek
16,461 Points

line 3 on index.php is missing a semicolon at the end

require_once "src/config.php";
Glenré Charl Labuschagné
Glenré Charl Labuschagné
23,202 Points

Hi annapoff,

In your src/config.php file your missing a $ before "dir/" variable…

          if (file_exists("$dir/" . $class_name . '.php')) {
            require_once "$dir/" . $class_name . '.php';

Hope it helps