An array is a special variable which can store multiple values.
<?php
//array is creating by following function
array();
?>
There are three types of arrays in PHP:
Indexed array is an array with a numeric index
<?php
$users = array('User 1', 'User 2', 'User 3');
//or (both are same)
$users = ['User 1', 'User 2', 'User 3'];
?>
Indexed array is an array with named keys
<?php
$user = array(
'name' => 'User 1',
'email' => 'user1@gmail.com',
'mobile_number' => '1111111111'
);
//or (both are same)
$user['name'] = 'User 1';
$user['email'] = 'user1@gmail.com';
$user['mobile_number'] = '1111111111';
?>
Indexed array is an array containing one or more arrays
<?php
$users = array(
'user1' => array(
'name' => 'User 1'
),
'user2' => array(
'name' => 'User 2'
),
);
?>