just a simple question
In this example, what does =>
do? and how to read it?
is it read by "is to" or "is equal"
$array = array(
'color' => 'red',
'shape' => 'round',
'radius' => '10',
'diameter' => '20'
);
Answer
Well, its not is to
or is equal
but the sign =>
is an assignment operator to assign values in array's indexes.
For example:
$x[0] = 10;
$x[1] = 20;
$x[2] = 30;
$x[3] = 40;
Or
$x = (0 => 10,
1 => 20,
2 => 30,
3 => 40,
);
No comments:
Post a Comment