3v4l.org

run code in 300+ PHP versions simultaneously
<?php // make other file $otherfile = <<< PHP <?php return ['admchat' => 'chat']; PHP; file_put_contents('tmp/otherfile.php', $otherfile); // loading from other file links and translation variables $englishTranslation = include 'tmp/otherfile.php'; $translation = '$englishTranslation["admchat"]'; var_dump($translation); $translation = $englishTranslation["admchat"]; var_dump($translation);
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.20, 7.0.22 - 7.0.33, 7.1.0 - 7.1.15, 7.1.17 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
string(30) "$englishTranslation["admchat"]" string(4) "chat"
Output for 7.1.16
Warning: include(tmp/otherfile.php): failed to open stream: No such file or directory in /in/WYGnP on line 11 Warning: include(): Failed opening 'tmp/otherfile.php' for inclusion (include_path='.:') in /in/WYGnP on line 11 string(30) "$englishTranslation["admchat"]" NULL
Output for 7.0.21
string(30) "$englishTranslation["admchat"]" NULL

preferences:
223.3 ms | 401 KiB | 287 Q