Coldfusion: Update array by passing its reference into function

36 views Asked by At

I am using CFWheels and I have my action and private function as such:

private function update_arr(arr)
{
    arr[1] = "val 1.1";
    arr[2] = "val 2";
}

public function t_test_1()
{
    title = "Test 1";
    arr = ArrayNew(1) ;
    arr[1] = "val 1";
    update_arr(arr);
}

I want to pass the arr variable by reference into the function "update_arr", so the arr values are updated to what it is assigned to inside the function. Right now if I cfdump arr

it only gives me:

1 : val 1

I want it to be:

1: val 1.1
2: val 2
0

There are 0 answers