Parse error: syntax error, unexpected ',', expecting ']' in D: \ wamp64 \ www \ PROJECTS- \ sist-crop \ jcrop \ m2brimagem.class.php on line 40

-1

How do I get this syntax error?

$this->extensoes_validas = $extensoes_validas ['jpg','jpeg','jpe','gif','bmp','png'];

What I wanted was to assign this array to $this->extensoes_validas

    
asked by anonymous 16.09.2017 / 21:09

2 answers

1

It's syntax error. This solves the problem:

$extensoes_validas = array('jpg','jpeg','jpe','gif','bmp','png');
$this->extensoes_validas = $extensoes_validas;
    
16.09.2017 / 22:56
0

The correct one would be:

$this->extensoes_validas = ['jpg','jpeg','jpe','gif','bmp','png'];

If you want to access some specific index of this array, you can use the following:

echo $this->extensoes_validas[0]; // jpg
echo $this->extensoes_validas[1]; // jpeg

And so on.

    
16.09.2017 / 22:11