Jump to content

Unexpected T_as error


acctman

Recommended Posts

can someone assist me with the code below? Unexpected T_as error

 

the countries.php file

$countries['US'] = array(name => 'United States');
$countries['AF'] = array(name => 'Afghanistan');

 

code..

if ($en['mm_country'] != US || CA) {
global $countries; include 'modules/members/countries.php';
$countries as $key => $value;
$key = $en['mm_country'];
$en['mm_coname'] = htmlentities($value['name'],ENT_QUOTES);
echo $en['mm_coname'];
}

Link to comment
https://forums.phpfreaks.com/topic/157387-unexpected-t_as-error/
Share on other sites

Then use normal array access

$key = "US";
$country = $countries[$key];

 

when i do that the result is just Array. the code needs to be something like this, but i'm not sure how to code it correctly.

 

if ($en['mm_country'] != US) || ($en['mm_country'] != CA) {
global $countries; include 'modules/members/countries.php';
$key = $en['mm_country'];
$country = $countries(htmlentities($key['name'],ENT_QUOTES));
echo $country;
}

 

What does "code it correctly" mean? You haven't told us what you want.

oh sorry i thought i did, i want to connect to countries.php and grab the country name. $en['mm_country'] holds the $key abbervation of the country. so if AF is supplied then when I echo $country the return value should be Afghanistan. also when grabbing the country name htmlentities needs to be used to strip the quotes

 

 

$countries['US'] = array(name => 'United States');

$countries['AF'] = array(name => 'Afghanistan');

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.