In Action

Php Toycode - Accessing Hash Data

Simple example for assessing hash data.

Php in Action


forloop



Toycode

Php Code

Just cut-n-paste to reuse.

     
<?php
$employees["employee 1"]["name"] = "Dana";
$employees["employee 1"]["title"] = "Owner";
$employees["employee 1"]["salary"] = "$60,000";

$employees["employee 2"]["name"] = "Matt";
$employees["employee 2"]["title"] = "Manager";
$employees["employee 2"]["salary"] = "$40,000";

$employees["employee 3"]["name"] = "Susan";
$employees["employee 3"]["title"] = "Cashier";
$employees["employee 3"]["salary"] = "$30,000";

echo $employees["employee 2"]["name"].
	" is the ".$employees["employee 2"]["title"].
	" and he earns ".$employees["employee 2"]["salary"].
	" a year.";
?>