How can you check if an array index exists before attempting to concatenate data in PHP?

When working with arrays in PHP, it's important to check if a specific index exists before attempting to access or modify its value. This can prevent errors like "Undefined index" or "Trying to access array offset on value of type null". One way to check if an array index exists is by using the isset() function, which returns true if the index exists and has a non-null value.

// Check if an array index exists before attempting to concatenate data
if(isset($array[$index])) {
    $array[$index] .= "additional data";
}