Posts

Showing posts from January, 2023

array within associative array computers example

<?php $index=0; $ computers =array( "computer1"=> array ("hdd"=>"400Gb","status"=>"working"), "computer2"=>array("hdd"=>"100GB","status"=>"Not working"), "computer3"=>array("hdd"=>"300Gb","status"=>"working"), "computer4"=>array("hdd"=>"1TB","status"=>"Not working") ); //print_r($computers); foreach($ computers as $comkey => $ comarray ) { echo $ comarray ["hdd"]." "; echo $ comarray ["status"]." "; echo "<br />"; } // output 400Gb    working 100GB   Not working 300Gb    working 1TB        Not working