check if cookie exists php

PHP
if (!isset($_COOKIE["lg"])) {
	setcookie("lg", "ro");
}
Source

Also in PHP: