sticky Posted December 2, 2008 Share Posted December 2, 2008 when i use wamp to get to localhost to view this file <?php //$values = array( //1 => '25', // 2 => '45', // 3 => '75' // array $meals = array ( 'breakfast' => "cereal", 'lunch' => "hot dog", 'dinner' => 'hamburger' print_r ($meals); ?> it returns the following error::Parse error: syntax error, unexpected T_STRING, expecting ')' in C:\wamp\www\DWC_Remote\arrays.php on line 16 i don't know if its a configuration thing with wamp or coding error. if some one can help that would be great. as u can see i'm brand new to php but enjoying so far. Link to comment https://forums.phpfreaks.com/topic/135084-cant-see-what-ive-done-incorrectly/ Share on other sites More sharing options...
DeanWhitehouse Posted December 2, 2008 Share Posted December 2, 2008 Learn arrays. $meals = array ( 'breakfast' => "cereal", 'lunch' => "hot dog", 'dinner' => 'hamburger' It is not closed. it should be $meals = array ( 'breakfast' => "cereal", 'lunch' => "hot dog", 'dinner' => 'hamburger' ); This should help http://djw-webdesign.awardspace.com/code.php?snippet=8 Link to comment https://forums.phpfreaks.com/topic/135084-cant-see-what-ive-done-incorrectly/#findComment-703606 Share on other sites More sharing options...
awpti Posted December 2, 2008 Share Posted December 2, 2008 This is the syntax I use for arrays: <?php $my_array = array ( 'some_key' => 'some_value', 'another_key' => 'another_value' ); Can't miss the closing parenthesis if you do it that way. Link to comment https://forums.phpfreaks.com/topic/135084-cant-see-what-ive-done-incorrectly/#findComment-703668 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.