Jump to content

Associative Array Tutorial Help


LynnStrauch

Recommended Posts

Hi,

 

I am following along, and doing well for the most part until I hit the Array tutorial #2.

 

Here is what I have, and I blows an error on line 17 everytime. I am getting kind of frustrated because it looks right, yet, it must not be.

 

What am I doing wrong. It is in the "first line of the actual array.

 

<?php

//Associative Arrays

 

 

$prices_array = array("TV" => "250.00", "DVD" => "100.00", "VHS" => "2.00",);

print $prices_array ['TV'];

 

?>

 

Thank you,

 

Lynn

Edited by LynnStrauch
Link to comment
Share on other sites

 

<?php

//Associative Arrays

 

$my_array = array("Elizabeth","Lynn","Lynette",7);

print "The value held in position 2: ";

print $my_array [2];

 

// Associatative Array Uses Name Value Pairs

print "

 

"

 

$prices_array = array("TV" => "250.00", "DVD" => "100.00", "VHS" => "2.00", );

print $prices_array ['TV'];

 

?>

 

Edited by LynnStrauch
Link to comment
Share on other sites

Hmm, it sems the array is a bit wrong;

$prices_array = array("TV" => "250.00", "DVD" => "100.00", "VHS" => "2.00", );

 

Should be (notice the last ", " i removed):

$prices_array = array("TV" => "250.00", "DVD" => "100.00", "VHS" => "2.00");

 

 

//Emil Fresk

Sweden

Link to comment
Share on other sites

Well, that did not work either. I am still getting the error after removing the comma and space. Stephan has it working with the comma and space...room for another I am assuming, and it works for him, and it is working for the other guy...but not for me...sigh.

 

Same Error though:

Parse error: parse error in C:\wamp\www\php_work\AssociativeArray.php on line 19

 

Lynn

Edited by LynnStrauch
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...