can an array have same values? say like array('a','a')?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
indian98476
Forum Commoner
Posts: 78
Joined: Tue Dec 15, 2009 3:24 am

can an array have same values? say like array('a','a')?

Post by indian98476 »

'empstatus'=>array('select','empstatus',array(array('','Choose One'), array('Associate','Associate'),
array('Government Employee','Government Employee'),
array('Partner','Partner'),
array('Solo Practice','Solo Practice'),
array('Independent Contractor','Independent Contractor'),
array('Law Student','Law Student'),
array('Other','Other')), array('class'=>"fillin2", 'style'=>"width:200px;"),'empstatus'),



could anyone explain me the above code? it was posted for a registration form and this is the employee status...
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: can an array have same values? say like array('a','a')?

Post by requinix »

To the first question you asked: yes, they can have any values - it's the array keys that have to be unique.

To the question you snuck in there: It's an array. It doesn't do anything by itself, but it looks like it represents a <select> form field.
indian98476
Forum Commoner
Posts: 78
Joined: Tue Dec 15, 2009 3:24 am

Re: can an array have same values? say like array('a','a')?

Post by indian98476 »

thnx..it sure is a select field in form....but why do they have the field name empstatus in the end after all the other arrays?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: can an array have same values? say like array('a','a')?

Post by requinix »

Because that's the way whoever wrote the code designed it.
Post Reply