Re: Arrays
| From: | Brad Hubbard | Date: | Fri, 26 Oct 2001 09:49:02 +0000 |
| Subject: | Re: Arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72424@lists.php.net to get a copy of this message | ||
On Fri, 26 Oct 2001 18:17, Ashley M. Kirchner wrote:
> I'd like to create an array of "available resources", and be able to
> check it every time. What I'd like to do is something like;
>
> $site = array( "section1" => #, "section2" => #, etc.. )
>
> where "section*" is a STRING variable and # is an INT (if it's even
> possible to do that)
<?php
// Suck 'em in
$site = array (
"section1" => 007,
"section2" => 11,
"section3" => 57.5,
"section4" => 12,
"section5" => 0.007,
"section6" => 15,
"section7" => 1007,
"section8" => 11007,
"section9" => 111007,
"section10" => 1
);
// Spit 'em out
while ( list ( $key, $val ) = each ( $site ) )
{
echo "$key => $val<br>";
}
?>
Cheers,
BAD