array / variable problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

elbarto
New php-forum User
New php-forum User
Posts: 2
Joined: Sat Jan 18, 2003 5:07 pm

array / variable problem

Postby elbarto » Sat Jan 18, 2003 5:15 pm

hi,
I am verry new to php. I think I have a simple problem but
I can't figur out a solution.
I have an array
$lay1 = array('1' , '2' , '3' , '4', '5', '6');
now I try to select the array $lay1[1] with the variable $layid
if ($pid == $lay.$layid[1])
but It dosen't work.
What is the correct way to do this?

Thanks for your answer.

::michi

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: array / variable problem

Postby WiZARD » Sun Jan 19, 2003 6:04 am

Try change at this if you want what in your array contain only digit:

Code: Select all

$lay1 = array(1 , 2 , 3 , 4, 5, 6);

or char:

Code: Select all

$lay1 = array("1" , "2" , "3" , "4", "5", "6");


P.S. And don't forget what in array first key is zero not one...

elbarto
New php-forum User
New php-forum User
Posts: 2
Joined: Sat Jan 18, 2003 5:07 pm

Postby elbarto » Sun Jan 19, 2003 3:19 pm

thanks for your answer. I have figured out a solution.

greetings

::michi


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron