Re: Re: what is wrong with my big array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ross wrote:

get a parse error!

$region_array = array('a' =>'All of Scotland', 1 =>'Aberdeen City Council', 2 =>'Aberdeenshire Council', 3 =>'AngusCouncil', 5 =>'Argyll and Bute Council', 6 => 'Clackmannanshire Council', 9 =>'Dumfries and Gallowalloway', 10 => 'Dundee City Council', 11 => 'East Ayrshire Council', 13 => 'East Dunbartonshire', 14 => 'East Lothian Council', 15 => 'East Renfrewshire Council', 16 =>'Edinburgh City Council', 17 =>'Falkirk Council', 18 =>'Fife Council', 20 =>'Highland Council', 21 =>'Inverclyde Council', 22 =>'Midlothian Council', 23 => 'Moray Council', 24 =>'North Ayrshire Council', 25 =>'North Lanarkshire Council', 26 =>'Orkney Islands Council', 27 =>'Perth & Kinross Council', 28 => 'Renfrewshire Council',29 =>'Scottish Borders Council', 30 = > 'Shetland Isles Council', 31 =>'South Ayrshire Council', 32 => 'South Lanarkshire Council', 33 => 'Stirling Council', 34 =>'West Dunbartonshire', 35 => 'West Lothian Council', 8 => 'Comhairle nan Eilean'); ?>
You might want to consider laying your code out in a more readable format.

$region_array = array(
                   'a' => 'All of Scotland',
                     1 => 'Aberdeen City Council',
                     2 => 'Aberdeenshire Council',
                     3 => 'AngusCouncil',
                     5 => 'Argyll and Bute Council',
                     6 => 'Clackmannanshire Council',
                     9 => 'Dumfries and Gallowalloway',
                    10 => 'Dundee City Council',
                    11 => 'East Ayrshire Council',
                    13 => 'East Dunbartonshire',
                    14 => 'East Lothian Council',
                    15 => 'East Renfrewshire Council',
                    16 => 'Edinburgh City Council',
                    17 => 'Falkirk Council',
                    18 => 'Fife Council',
                    20 => 'Highland Council',
                    21 => 'Inverclyde Council',
                    22 => 'Midlothian Council',
                    23 => 'Moray Council',
                    24 => 'North Ayrshire Council',
                    25 => 'North Lanarkshire Council',
                    26 => 'Orkney Islands Council',
                    27 => 'Perth & Kinross Council',
                    28 => 'Renfrewshire Council',
                    29 => 'Scottish Borders Council',
                    30 = > 'Shetland Isles Council',
                    31 => 'South Ayrshire Council',
                    32 => 'South Lanarkshire Council',
                    33 => 'Stirling Council',
                    34 => 'West Dunbartonshire',
                    35 => 'West Lothian Council',
                     8 => 'Comhairle nan Eilean');

As already pointed out, there is a space between the = and > after the 30. Laying code out like this also tends to limit the amount of code you need to look at to find syntax errors like this since PHP happily points to the precise line.

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux