|
Posted by Pablo M. Rivas on 02/18/05 15:18
Hello Merlin:
take a look to http://www.php.net/manual/en/language.types.array.php
$para[5]=array('txt' => 'Europe'.$continent['name'],
'link' => '/'.$continent[name].'.htm',
'title' => 'Europe - Continent overview');
$para[]=array('txt' => 'America'.$continent['name'],
'link' => '/'.$continent[name].'.htm',
'title' => 'America- Continent overview');
$para[] will be 6,7,8,9... and so on
On Fri, 18 Feb 2005 13:52:29 +0100, Merlin <news.groups@web.de> wrote:
> Marek Kilimajer wrote:
> > Merlin wrote:
> >
> >> Hi there,
> >>
> >> I am wondering if there is a nicer way to save the data into an array
> >> than I do.
> >>
> >> I do have a 2 dimensional array "$para".
> >>
> >> Currently I go like this:
> >>
> >> $para[1][txt] = 'Europe'.$continent[name];
> >> $para[1][link] = '/'.$continent[name].'.htm';
> >> $para[1][title] = 'Europe - Continent overview';
> >> $para[2][txt] = $country;
> >> $para[2][link] = '/'.$continent[name].'.htm';
> >> $para[2][title] = $country;
> >>
> >> That becomes really difficult if you have more of them, and you want
> >> to reorganize the ordering. Then you have to rename all numbers.
> >>
> >> Is there a nicer way to do that?
> >>
> >> Thank you for any hint,
> >>
> >> Merlin
> >>
> >
> > $para = array();
> >
> > $para[] = array('txt' => 'Europe'.$continent['name'],
> > 'link' => '/'.$continent[name].'.htm',
> > 'title' => 'Europe - Continent overview');
> >
> > $para[] = array('txt' => $country,
> > 'link' => '/'.$continent[name].'.htm',
> > 'title' => $country);
>
> Thanx that is much better.
>
> However I have to start the array with 1 instead of 0
> and I cant remember and find the proper syntax. It was something like: array(=>1
>
> What was that again?
>
> Thanx, Merlin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Pablo M. Rivas. http://www.pmrivas.com http://www.r3soft.com.ar
-----------------------------------------------------------
Navigation:
[Reply to this message]
|