Julie
Julie

Reputation: 11

syntax error, unexpected T_STATIC

I have this error while trying to use late static bindings. All I can find in google about this error is that people didn't have PHP5.3, but I have version 5.3.6.

Could someone help me please ?

Thanks

class Media
{
    private $nom,
            $ext;

    public function ext_autorisees() { return array(); }

    public function __construct( $fichier, $thumb = false )
    {
        $fichier = explode( ".", $fichier );

        $nom = $fichier[0];
        $ext = $fichier[1];

        if( in_array( strtoupper( $ext ), static::ext_autorisees() ) )
        {
            if( strpos( $nom, "thumb_" ) === 0 && !$thumb )
                throw new Exception("");
        }
        else
            throw new Exception("");

        $this->nom = $nom;
        $this->ext = $ext;
    }

    public function getNom() { return $this->nom; }
    public function getExt() { return $this->ext; }
    public function getPath() { return $this->getNom() . "." . $this->getExt(); }
    public function getThumb() { return "thumb_" . $this->getPath(); }

}

Upvotes: 1

Views: 2326

Answers (1)

devtut
devtut

Reputation: 697

there is a problem in static::ext_autorisees()

Upvotes: 1

Related Questions