-1
How do I fix 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
-1
How do I fix 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
1
It’s a syntax error. That solves the problem:
$extensoes_validas = array('jpg','jpeg','jpe','gif','bmp','png');
$this->extensoes_validas = $extensoes_validas;
worth leandro by force worked cool , man I do not know this kind of assignment with coaches , that the value is inside and atrbui with the arrow and equal , I did not see also in the courses around , the guys should teach this.
You’re welcome @Francisco. Then read this link, is referring to what you should do when someone answers your question.
0
The right thing 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 and so forth.
That doesn’t answer his question.
The error is occurring because he is making the assignment the wrong way. If assigning using square bracket syntax correctly, no error will occur.
that same Danilo , thanks by force but its attribution also did not work, I used the below , man I do not know this type of attribution in php courses around , just looking at code ready the guys should pass it to students..
Browser other questions tagged php array
You are not signed in. Login or sign up in order to post.
Francis, welcome! I think both answers solve your problem. One with syntax
array(..)
another with syntax[...]
but do the same thing. Choose one and click on the symbol to accept the answer.– Sergio