What is the best way to add a second line to an array in PHP?

To add a second line to an array in PHP, you can simply use the array_push() function to insert the new element at the end of the array. This function will automatically reindex the array with numeric keys starting from 0. Alternatively, you can directly assign a new value to a specific index in the array to add a second line.

<?php
// Using array_push()
$array = array("first line");
array_push($array, "second line");

// Using direct assignment
$array[1] = "second line";
?>