Help! How do you create hashtable in php?

This is what I want to do. First, create hashtable like the following

$MatchCategory=Array();
$MatchCategory["Software"]="1";
$MatchCategory["Hardware"]="2";
$MatchCategory["Internet"]="3";

And I want to get 1, 2, or 3, given a key. Apparently,

$temp = $MatchCategory["Software"];

does not work. How do you create hashtable in php and how do you use it?

It doensn’t work? What’s the content of $temp. It should be 1.
Print out the array with print. Then you see the content of the array. Hashtables are not really necessary because you can use associative arrays in PHP.

fbronx,

Hi, Thanks for helping me out.

It doesn’t work? What’s the content of $temp. It should be 1. Print out the array with print.

This part seems to be working right. Question for you: can we also put “\” forward slash and “/” backslash as a key like?


$MatchCategory["/Software"]="1";

Hashtables are not really necessary because you can use associative arrays in PHP.

How do you use associatetive array in php? Can you give me a quick tutorial or … reference me some short article?

http://hotwired.lycos.com/webmonkey/01/48/index2a_page7.html?tw=programming