What are the advantages and disadvantages of storing language text in arrays versus external files in PHP?

Storing language text in arrays in PHP can make it easier to manage and access translations within the code itself, but it can also clutter the code and make it harder to update translations. On the other hand, storing language text in external files can keep the code cleaner and make it easier to update translations, but it may require additional file I/O operations which can impact performance.

// Storing language text in arrays
$lang = [
    'hello' => 'Hello',
    'goodbye' => 'Goodbye'
];

echo $lang['hello'];

// Storing language text in external files
$lang = include 'lang.php';

echo $lang['hello'];