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


#1

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

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


#2

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:


#3

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


#4

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


#5

I see. Thanks for your advice.


#6

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