An easy way way to test your function
And notice my correct use of full tag: <?php
You are a LAZY one, I suppose ๐
See my signature!
<?php
/**
* Generate a Cart ID
*/
function generateCart() {
// test
echo '<pre>'. print_r($_COOKIE['cartid'], true) .'</pre>';
if(!isset($_COOKIE['cartid'])) {
$cartid = md5(uniqid(rand()));
setcookie("cartid", $cartid, time() + 14400);
} else {
$cartid = $_COOKIE['cartid'];
}
return $cartid;
}
?>