如何将值附加到PHP中的数组中的数组? [重复]

This question already has an answer here:

Given this PHP array:

$options['systems'] = array(1, 2, 3)

How would I append the value 4 to the $systems array within the $options array?

</div>

You could use array_push to push additional items like so:

array_push($options['systems'], 4);

Or the shorthand version:

$options['systems'][] = 4;

You can use php array_push function. Like this. array_push($options['systems'],4);

you can read the detail of array_push from below link.array_push manual