Jump to content

[SOLVED] How to access an array


genu

Recommended Posts

How can I access an array through a variable?

 

for example: I have: $_GET['task'] = "january"

 

and I have a predefined array like so:

$january = array('test1','test2','test3');

 

how can I access the $janurary array based on the the value of $task?

 

I tried:

echo $task[0];

 

but returned just "j" instead of 'test1'

 

is there another way to reference that $january array?

Link to comment
https://forums.phpfreaks.com/topic/112939-solved-how-to-access-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.