"[ ]" vs. "{ }" in PHP at 5/7


Hi everyone,
I just wonder whats the Difference between [ ] and { } if they give the same product at 5/7 ? Like:
$tens = array(10, 20, 30, 40, 50);
echo $tens {2};
Prints: 30;

$tens = array(10, 20, 30, 40, 50);
echo $tens [2];
Prints also: 30;
Any Idead ?
Thanks ahead.


I'm pretty sure that there is no difference! It says in the instructions of 5/7:

"Both forms are equivalent, and using one or the other is totally up to you!"

In some questions it tells you which one to use, but normally you can choose>
Hope that helped! :smile:


Then I dont understand why they came up with this... :-/


Probably to make you aware of what you can and cannot do. As they say, knowledge is power!


I see. Thanks for your advice.


It is my opinion that this part of the lesson should be removed. It is rarely used and discouraged by practically everyone.