how to index arrays and show all the elements and values of array

Mobile
feeds
Welcome Login | Register

how to index arrays and show all the elements and values of array
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » Snippets Forums
        » » how to index arrays and show all the elements and values of array
how to index arrays and show all the elements and values of array
Post Description: how to index arrays and show all the elements and values of array Snippets
Post Tags:
This Post Has Been Viewed 741 Times Since Sun Feb 24, 2008 12:07 pm Author hostman with 0 replies
how to index arrays and show all the elements and values of array
Advertise On This Page




indexing arrays with string



so far i've only seen arrays indexed by itergers, but it is also permissbible to use strings. sometimes there are called assocaited arrays, or hashes. they are helpful in situations where you are colectin differen type so information into one array. you could build inot your code a system where element zeor is a name, element one is a location, and element two is an occupation

here is an example:

<?php
// fill in some information
$userinfo["Name"] = "John Doe";
$userinfo["Location"] = "San Francisco";
$userinfo["Occupation"] = "Programmer";

foreach($userinfo as $key=>$value) {
print("$key is $value.<br>");
}
?>


the above will output:
Name is John Doe
Location is San Francisco
Occupation Programmer



Leave Your Comments

Share:   Subscribe - Keep Up With This Topic
You can use this HTML code to put it on your website to show your friends this wallpaper. Use this code on your profile like myspace, friendster, Facebook or others. Just Copy and Paste it in your HTML on your websites
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
Fourms BBCODE:
Links Related to : how to index arrays and show all the elements and values of array
Add Link:
No Links Have Been Added To This Topic

Comments and replies About how to index arrays and show all the elements and values of array
(0) Comments