[Solved] How to use proper variable in php? [closed]

You should better a try var_dump($row) or print_r($row) first to see if the array contains the datas at right keys.

$lang[$row[0]] doesnt work because $row[0] is empty.

Your are probably not assigning Hello to $row[0].

So try print_r($row); to see whats stored in the whole array.

Add :

$lang[$row[0]] will give you $lang[hello].

It should be $lang[“$row[0]”] for it to be $lang[“hello”]

Sample code :

$row = array("Hello","Hello Again");
$lang['Hello'] = "Working";
echo $lang["$row[0]"];

Please change your attitude. Give out codes, and wait for people to answer. People are here to help.

Ask your question and people will answer you, but please dont DEMAND.


solved How to use proper variable in php? [closed]