Jump to content

Array problem


boylesg
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...