<?php
// PHP setcookie Action ... partner to sender_of_cookie.php
// RJM Programming - April, 2019
// Thanks to https://www.php.net/manual/en/function.setcookie.php
echo "<html><body>";

if (1 == 2) {
  // Print an individual cookie
  echo "<p>" . $_COOKIE["TestCookie"];
  echo "</p><br><br>";
}

echo "<p>";

// Another way to debug/test is to view all cookies
$res = print_r($_COOKIE, TRUE);

$cs = explode('] => ', $res);

for ($i=1; $i<sizeof($cs); $i++) {
  echo "Cookie named '" . explode('[', $cs[-1+ $i])[-1 + sizeof(explode('[', $cs[-1+ $i]))] . "' has value '" . explode(')', explode('[', $cs[$i])[0])[0] . "'.<br>";
}

//print_r($res);

echo "</p></body></html>";
?>
