Re: [SMARTY] {section} with array that doesnt start with index 0
| From: | Roman Neuhauser | Date: | Mon, 19 Aug 2002 10:34:06 +0000 |
| Subject: | Re: [SMARTY] {section} with array that doesnt start with index 0 | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5756@lists.php.net to get a copy of this message | ||
> From: "Peter Billen" <peter@clueless.be>
> To: "'Smarty General'" <smarty-general@lists.php.net>
> Date: Mon, 19 Aug 2002 12:19:17 +0200
> Subject: RE: [SMARTY] {section} with array that doesnt start with index 0
> But what is then the best option to construct the array:
>
> $array[0]['countryName'] = "Belgium";
> $array[0]['countryNameShort'] = "BE";
>
> $array[1]['countryName'] = "United Kingdom";
> $array[1]['countryNameShort'] = "UK";
>
> or
>
> $array['countryNames'][0] = "Belgium";
> $array['countryNamesShort'][0] = "BE";
>
> $array['countryNames'][1] = "United Kingdom";
> $array['countryNamesShort'][1] = "UK";
this basically depends on your taste, but i find the first version
more logical.
> I myself suppose the best one is the first one, because it's easier (is
> it?) to loop through. However with option 1, I guess you can't use the
> array_push function.
array_push($foo, array('name'=>'Belgium',
'code'=>'BE'));
but this doesn't belong to this list.
--
FreeBSD 4.6-STABLE
12:28PM up 10 days, 23 mins, 17 users, load averages: 0.00, 0.19, 0.25