If $pos
is different than 0
the variable $cookieValue
is not defined:
You only define it in the case is 0
:
if ($pos === 0) {
$str = explode("=",$headerLine);
$value = explode(";",$str[1]);
$cookieValue = $value[0];
break;
}
You should define it at the start of the function with some default value for the case $pos
is not 0
.