Computing.Net > Forums > Web Development > Array: keys and values

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Array: keys and values

Reply to Message Icon

Name: joba
Date: May 3, 2007 at 06:44:54 Pacific
OS: Win Vista Premium
CPU/Ram: Intel centrino, 2gb ram
Product: HP
Comment:

If an array looks like this:
$answers = array( 'gender', 'age', 'income', 'home', 'time_online', 'it_knowhow', 'online_buys')

Will the values to each key be NULL?



Sponsored Link
Ads by Google

Response Number 1
Name: Laler
Date: May 3, 2007 at 15:00:30 Pacific
Reply:

nope, in the above array, the keys will be: 0, 1, 2, 3, 4, 5, 6


---
Fubar


0

Response Number 2
Name: wizard-ict
Date: May 13, 2007 at 09:44:33 Pacific
Reply:

An array key can never be NULL, otherwise it would completely defeat the point of having an array.
If you don't define the key (as in your example above), it will automatically be created starting at 0. Giving you the keys as stated by Laler

Wizard ICT. Microsoft Certified System Engineer.
www.wizard-ict.co.uk


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Array: keys and values

Querying a row from MySQL database with PHP www.computing.net/answers/webdevel/querying-a-row-from-mysql-database-with-php/4094.html

auto submit form / ajax www.computing.net/answers/webdevel/auto-submit-form-ajax/3879.html

Checking values in an array www.computing.net/answers/webdevel/checking-values-in-an-array/3231.html