note 82802 deleted from function.trim by hholzgra

From: Date: Thu, 02 Aug 2012 12:27:15 +0000
Subject: note 82802 deleted from function.trim by hholzgra
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189661@lists.php.net to get a copy of this message
Note Submitter: luciano[dot]longo[at]gmail ---- Yet another array trim, recursive too. I think this one is pretty usefull, though it lacks charlist, you can add that functionality if you need to, it's not that hard ;) Anyway, one feature that I added, and I find pretty usefull, is that it can splice an empty position if you want to <?php function array_trim_recursive(&$array, $splice_empty = true) { foreach($array as $k => &$v) { if(is_array($v)) { array_trim_recursive($v, $splice_empty); } else { $array[$k] = trim($v); iif(!$v && $splice_empty) { array_splice($array, $k, 1); } } } } ?>

« previous php.notes (#189661) next »