@Burti; sen orda preg_match yerine str_contains kullansan daha iyi olur. (str_contains PHP'ye dahili bi' fonksiyon değildir, harici olarak eklenebilir.)
str_contains fonksiyonu;
function str_contains($haystack, $needle)
{
return (bool) strpos($haystack, $needle) !== false;
}kullanımı;
if(str_contains($id, $_SESSION["product"]))
{
// buldum.
}
else
{
// bulamadım.
}