function array2cookie($arr,$cname,$ctime=0,$cpath="/",$cdomain="")
{
//$_arr = arrayWalk($arr,"urlencode");
$_arr = serialize($arr);
setcookie("$cname",$_arr,$ctime,"$cpath",$cdomain);
unset($_arr);
}
function arrayWalk($arr,$func)
{
switch(!is_array($arr))
{
case true:
return $arr;
break;
}
foreach($arr as $key=>$val)
{
switch(is_array($val))
{
case true:
$arr[$key] = arrayWalk($val,$func);
break;
default :
$_val = "\$arr[$key] = $func(\"$val\");";
eval($_val);
break;
}
}
return $arr;
}
function cookie2array($cname)
{
$arr = unserialize(stripslashes($_COOKIE["$cname"]));
$arr = arrayWalk($arr,"urldecode");
return $arr;
}
{
//$_arr = arrayWalk($arr,"urlencode");
$_arr = serialize($arr);
setcookie("$cname",$_arr,$ctime,"$cpath",$cdomain);
unset($_arr);
}
function arrayWalk($arr,$func)
{
switch(!is_array($arr))
{
case true:
return $arr;
break;
}
foreach($arr as $key=>$val)
{
switch(is_array($val))
{
case true:
$arr[$key] = arrayWalk($val,$func);
break;
default :
$_val = "\$arr[$key] = $func(\"$val\");";
eval($_val);
break;
}
}
return $arr;
}
function cookie2array($cname)
{
$arr = unserialize(stripslashes($_COOKIE["$cname"]));
$arr = arrayWalk($arr,"urldecode");
return $arr;
}
'PHP' 카테고리의 다른 글
날짜,시간 포맷,계산 관련 함수 (0) | 2008.12.13 |
---|---|
php4 이하에서의 scandir (0) | 2008.12.13 |
퍼센트 관련 함수 (0) | 2008.12.13 |
getIconv($fromchar,$tochar,$str) - $str:문자열/배열 (0) | 2008.12.13 |
php4 에서의 stripos(), str_ireplace() (0) | 2008.12.13 |