note 111526 added to function.array-replace
| From: | ghighi-du63 at hotmail dot fr | Date: | Thu, 28 Feb 2013 22:18:11 +0000 |
| Subject: | note 111526 added to function.array-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193757@lists.php.net to get a copy of this message | ||
Function that replace empty vals with $replace = "N/A"
Function parametters :
$array as array => array to be parsed
$replace as string => replace
function rep_empty_vals_arr($array,$replace = "N/A")
{
$returned_array = array();
foreach($array as $k=>$v)
{
if(is_array($v))
{
$returned_array[$k] = rep_empty_vals_arr($v,$replace);
}
if(empty($v))
{
$returned_array[$k] = $replace;
}else{
$returned_array[$k] = $v;
}
}
return $returned_array;
}
----
Server IP: 69.147.83.199
Probable Submitter: 90.9.155.112
----
Manual Page -- http://php.net/manual/en/function.array-replace.php
Edit -- https://master.php.net/note/edit/111526
Del: integrated -- https://master.php.net/note/delete/111526/integrated
Del: useless -- https://master.php.net/note/delete/111526/useless
Del: bad code -- https://master.php.net/note/delete/111526/bad+code
Del: spam -- https://master.php.net/note/delete/111526/spam
Del: non-english -- https://master.php.net/note/delete/111526/non-english
Del: in docs -- https://master.php.net/note/delete/111526/in+docs
Del: other reasons-- https://master.php.net/note/delete/111526
Reject -- https://master.php.net/note/reject/111526
Search -- https://master.php.net/manage/user-notes.php