X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fplatal.inc.php;h=38912a22dc2b23bf6d48b74baeb070f205525a6b;hb=983284ba502852d0d50c9073274d6de3001acab6;hp=d8155f5968dc251ba3b581c70f51455cdc6450c0;hpb=ded3ae94c0786b4cf7e6c9e4e704b0d97a3a5be7;p=platal.git diff --git a/include/platal.inc.php b/include/platal.inc.php index d8155f5..38912a2 100644 --- a/include/platal.inc.php +++ b/include/platal.inc.php @@ -182,6 +182,24 @@ function pl_entity_decode($text, $mode = ENT_COMPAT) return html_entity_decode($text, $mode, 'UTF-8'); } +function pl_flatten_aux(array &$dest, array $src) +{ + foreach ($src as $val) { + if (is_array($val)) { + pl_flatten_aux($dest, $val); + } else { + $dest[] = $val; + } + } +} + +function pl_flatten(array $array) +{ + $res = array(); + pl_flatten_aux($res, $array); + return $res; +} + /** * Returns the path of a static content, including, when appropriate, the * version number. This is used to avoid cross-version cache issues, by ensuiring