How can context be effectively utilized in a PHP translation array?

When translating text in PHP using an array, it's important to consider context to handle different translations for the same word depending on the context it appears in. One way to effectively utilize context in a PHP translation array is to use a multidimensional array where the key is the word and the value is an array containing the translations for that word in different contexts.

// Example of utilizing context in a PHP translation array
$translations = [
    'book' => [
        'default' => 'book',
        'verb' => 'to book a flight'
    ],
    'table' => [
        'default' => 'table',
        'furniture' => 'dining table'
    ]
];

// Usage example
echo $translations['book']['default']; // Output: book
echo $translations['book']['verb']; // Output: to book a flight
echo $translations['table']['default']; // Output: table
echo $translations['table']['furniture']; // Output: dining table