johnjoallen — 2010-07-15T12:04:53-04:00 — #1
I've got a $_SESSION array which takes in user information (integer values) but some of the fields can be left blank. So I need to replace the blank elements in the array with zero (i.e. 0) so I can do some more processing.
Hope someone can help
scallioxtx — 2010-07-15T12:42:34-04:00 — #2
foreach($arr as $key=>$val)
$arr[$key] = replaceWithZeroes($arr[$key]);
if ($val == '') $arr[$key] = 0;
$_SESSION = replaceWithZeroes($_SESSION);
Is that what you mean?
Why do you want this btw, sounds a bit hacky to me ...
johnjoallen — 2010-07-15T13:11:23-04:00 — #3
Yeah thats what I mean. I'm just tryin to solve a small problem and I know bad practice to hack.
Thank you for your help