What are the benefits of using [] to add values to an array in PHP instead of array_push()?

Using [] to add values to an array in PHP is more concise and readable than using the array_push() function. It also has better performance because it directly appends the value to the end of the array without the overhead of a function call. Additionally, using [] allows you to add multiple values at once by simply separating them with commas.

// Using [] to add values to an array
$myArray = [];
$myArray[] = 'value1';
$myArray[] = 'value2';
$myArray[] = 'value3';

print_r($myArray);