使用php的语法错误

i have this line here.. it gives me an error.. Could you please take a look at this?

Thanks

$slideshow-auto2=$this->params->get("slideshow-auto2");

I think you're missing a >:

$slideshow->auto2=$this->params->get("slideshow-auto2");
//         ^ Right here

Invalid variable name:

$slideshow-auto2=$this->params->get("slideshow-auto2");
          ^---can't have this in a var name. 

You're trying to do (from PHP's view), $slideshow minus constant "auto2" equals ...

You're trying to substract a property from an object, I guess you want to access that property so add a '>'

$slideshow->auto2=$this->params->get("slideshow-auto2");

Are you trying to use a hyphen within a variable name? That won't work because it's being interpreted as a minus sign and subtracting a property from an object does not work. You probably want something like this instead:

$slideshow->auto2=$this->params->get("slideshow-auto2");

Edit: If you don't intend to access the property 'auto2', simply replace the hyphen with a valid character for a variable name.

$slideshow-auto2 is not a valid variable name. You can't have hyphens in a variable name (PHP sees it as a minus).

Most of the other answers are guessing that you intended to use the -> syntax. If $slideshow is an object and auto2 is a property of that object, then this is what you want.

However, given the context of the rest of your line of code, my guess is that you want to have an actual variable named $slideshow-auto2. Unfortunately, this just isn't allowed. You'll need to work around it. You could name your variable $slideshowAuto2 or $slideshow_auto2 or various other alternatives, but not $slideshow-auto2.