Link to home
Start Free TrialLog in
Avatar of elbarro
elbarro

asked on

unexpected T_VARIABLE php

Im new to Classes in PHP and have a rather odd problem.  Im getting an unexpected T_VARIABLE error.  I've checked, double checked and triple checked any missing semi-colons, comas, etc and still nothing.  Here is the code snipit:

Here is where I get the error:
(d is of type Directions and places is an array of Route objects)

echo "$d->getRoute($i)->getName()";
if($dir == $d->getRoute($i)->getName())
{
  echo "orange_text";
}

// code snippets
class Directions{
  function getRoute($i){
    return $this->places[$i];
  }
}

class Route{
    function getName(){
    return $this->name;
  }
}
ASKER CERTIFIED SOLUTION
Avatar of Zontar
Zontar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of elbarro
elbarro

ASKER

I answered my question.  Turns out i did indeed make an error. Thanks for your help