Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

array / variable problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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
elbarto
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat Jan 18, 2003 5:07 pm

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...
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

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

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

greetings

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


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron