TottoBennington Posted February 20, 2012 Share Posted February 20, 2012 ERROR MESSAGE: Parse error: syntax error, unexpected '(' in C:\xampp\htdocs\cart\cart.php on line 6 <?php function cart() { foreach($_SESSION as $name => $value) { if ($value>0) { if (substr($name, 0, 5) == 'cart_') { $id = substr ($name,5 (strlen($name) -5)); echo $id; } } else { echo 'your cart is empty'; } } } ?> [code/] Link to comment https://forums.phpfreaks.com/topic/257342-php-syntax-error/ Share on other sites More sharing options...
kicken Posted February 20, 2012 Share Posted February 20, 2012 $id = substr ($name,5 (strlen($name) -5)); That line is missing a comma. Link to comment https://forums.phpfreaks.com/topic/257342-php-syntax-error/#findComment-1319048 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.