I want to check if the given value is present in array or not.
Here i have a function where in i will pass one value as parameter.
i have a array $_SESSION['cart'] where i have stored multiple values,while iterating the array i want to check if the product_id is in array
i am calling function while iterating array to check if product_id exists
<?php
foreach($_SESSION['cart'] as $item):
getCartitems($item);
endforeach;
?>
function
function productIncart($product_id){
//check if the $_SESSION['cart']; has the given product id
//if yes
//return true
//else
//return false
}
how can i do this?
$_SESSION['cart']?