Thursday, 14 April 2016

What is => in codeigniter



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

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...