Share » Forums » Developer » Access two elements of an array

Access two elements of an array

Access two elements of an array

Monday 15 May 2006 6:49:12 pm - 3 replies

Author Message

Nicolas Ottavi

Tuesday 16 May 2006 3:37:03 am

Hi,

With a foreach you can access the index, and then after that you could be able to do what you want.

{foreach $list_item as $index => $item}
...
{/foreach}

Regards,
Nicolas

Jorge estévez

Tuesday 16 May 2006 4:31:54 am

Can you be more specific?

How to access a object of an array Array(index).name, Array[index].name ?

I need to access attributes of an element of the array, so index plays an important role as well as the attribute I whant to access, just cant the code working...

thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Nicolas Ottavi

Friday 19 May 2006 3:59:18 am

Hi,

{$array.0} {* return first element of an array *}
{$array.$index} {* return element at $index position *}

Hope it helps,
Nicolas

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu