Help with Arrays.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi! I'm kinda new to php and I am stumped by a dilemma.

Okay I have a string called $word which contains "global" or any other
Then I also have a set or arrays which is named after the strings in
the $word variable like $global[]
I also have a value called $tem5 depicting the current array index.

A short version would be

$global[1]="some string";

How can I get the value of $global[1] then using the $word and $temp

I tried
$wordn = $word[$temp5]; <==obviously didn't work;

parse_str("" . "worrn=(" . $word. "[" . $temp5 ."])"); <==somehow
didn't work
parse_str("" . "worrn=($" . $word. "[" . $temp5 ."])"); <==somehow
didn't work
parse_str("" . "worrn=($" . $word. "[" . $temp5 ."])"); <==somehow
didn't work

Then I tried to check if i can actually pass on the values
$wordn = $global[1]; <==which worked.

So how can I access an array if I have its name and index?
Please help.

Re: Help with Arrays.

fogger schreef:

Quoted text here. Click to load it


Note the double $ before 'word'.


Site Timeline