Forums / Setup & design / Change values in arrays

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Change values in arrays

Author Message

paolo barbieri

Sunday 12 June 2005 5:07:44 pm

I'm trying to change the value of a specified element in an array with the value of another array.
This is the code:

{set myarray[0]=$otherarray[3]}

But it doesn't work!
What's wrong?
I've found a 'replace' function, but it seems still not implemented yet.

Note that my array is the result of a fetch (so, it's an array of objects).

Please....i'm going crazy with this... :-/

<i>"Vinum bibant homines, animalia cetera fontes..."</i>

Serg Tsay

Wednesday 15 June 2005 9:40:45 pm

I solve this problem, here solution:

1. Remove element that you want to change($index - element index):
{set myarray=$myarray|remove($index, 1)}
2. Insert new element at needed place:
{set myarray=$myarray|insert($index, $newvalue)}