i have php file like below and i want to read this php file and get all array value in this php file and i can update value of array
<?php
$lang['country_name']="Country Name";
$lang['zip_code']="Zip Code";
$lang['flag']="Flag";
$lang['site_enabled']="Site Enabled";
$lang['save']="Save";
$lang['cancel']="Cancel";
$lang['country_info']="Country Information";
$lang['new_country']="New Country";
$lang['edit_country']="Edit Counry";
$lang['country']="Country";
$lang['home']="Home";
$lang['no']="No";
$lang['action']="Action";
$lang['show']="Show";
?>
If you want to include this PHP array in another script, you can use the include
function.
For example, if you have another file, index.php
in the same directory, you can include
it and then you will have access to the variable. You can modify it like a normal variable, like so:
index.php
<?php
include `lang_array.php`; // will get the file with the array
echo $lang["no"]; // should output "No"
$lang["show"] = "value"; // update $lang["show"]
?>
Simply you just have include file using php include function.
<?php
include 'file_name.php';
$lang['new_country']="new country 1";
?>