in php3 you used
setcookie("cookie_name","cookie_value");
before the page header was sent.
Then subsequent pages on the site just treat the variable as normal. The page that initially sets the cookie might not see it, so try something like:
<? if ($myCookie==""):
setcookie("myCookie","foo");
$myCookie="foo";
endif;
?>
<? echo "myCookie= $myCookie"; ?>
Haven't used PHP4 - your mileage may vary.. :)