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/] Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/257342-php-syntax-error/#findComment-1319048 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.