[Solved] How to declare an associative array in PHP using array()? [closed]


To assign values to array with keys. You can simply write:

$files = array();
$files['some_key'] = 'an important value';
$files['another_key'] = 'a value';
$files['key'] = 'an non-important value';

Output:

Array
(
    [some_key] => an important value
    [another_key] => a value
    [key] => an non-important value
)

You can also just create an array by simply stating var[array_key'] = some_value'.

For example:

$another['key'] = "WOW... that's cool";

Output:

Array
(
    [key] => WOW... that's cool
)

And… enjoy…

solved How to declare an associative array in PHP using array()? [closed]