Jump to content

Array problem


boylesg

Recommended Posts

$ItemList = array( array ( "ItemCode"=>"SP", "ItemAvailable"=>true, "ItemPhotoURL"=>"http://i209.photobucket.com/albums/bb196/boylesg/SmallPlants/Brachyscome_basaltica.jpg", "ItemScientificName"=>"Brachyscome basaltica", "ItemCommonName"=>"Basalt Daisy", "ItemHeight"=>"30cm", "ItemSpread"=>"1m", "ItemDroughtTolerance"=>"10", "ItemWaterlogTolerance"=>"Seasonal", "ItemSoil"=>ClayLoamSoil, "ItemAspect"=>NoLightShade, "ItemComments"=>"Forms a spreading clump, prune back to rejuvenate.", "ItemStatus"=>LocalNative, "ItemSize"=>TubeSize, "ItemPrice"=>TubePrice, "ItemEdible"=>"", "ItemFlowers"=>"September - November" ), . . . X 32 elements like the above);?>Intervening HTML<?phpecho "***********************************<br>";echo count($ItemList) . "<br>";echo "***********************************<br>";WritePlantTable(ItemList, Title, ThisPage, "");?>The above echo statement outputs 32 as expected but inside the function it outputs 1.Why?

Link to comment
Share on other sites

WritePlantTable(ItemList, Title, ThisPage, "");
Those aren't variable names that you're passing in. Unless defined elsewhere PHP will probably treat them as undefined constants.
Link to comment
Share on other sites

Those aren't variable names that you're passing in. Unless defined elsewhere PHP will probably treat them as undefined constants.
Which, in turn, it will interpret as strings."Undefined constant ItemList, assuming 'ItemList'"Therefore, counted as an array with a single element.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...