1

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'
);
Naveed Ramzan
  • 3,565
  • 3
  • 25
  • 30
  • 1
    Possible duplicate of [What Does This Mean in PHP -> or =>](https://stackoverflow.com/questions/14037290/what-does-this-mean-in-php-or) – Yahya Dec 11 '17 at 04:24

2 Answers2

1

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,
    );
Naveed Ramzan
  • 3,565
  • 3
  • 25
  • 30
0

=> separates key and value pairs in PHP array. It is not related to Codeigniter. See more details about PHP array from this link.

Naveed Ramzan
  • 3,565
  • 3
  • 25
  • 30
Web_Developer
  • 1,251
  • 2
  • 18
  • 34