note 99750 added to function.array-values
| From: | BWPanda at osu1 dot php dot net | Date: | Fri, 03 Sep 2010 00:45:10 +0000 |
| Subject: | note 99750 added to function.array-values | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172285@lists.php.net to get a copy of this message | ||
I think the code in #97715 below could be better written as:
<?php
function array_flatten($a,$f=array()){
if(!$a||!is_array($a))return $f;
foreach($a as $k=>$v){
if(is_array($v))$f=array_flatten($v,$f);
else $f[$k]=$v;
}
return $f;
}
?>
Namely, changing the first return value from '' to $f...
----
Server IP: 69.147.83.197
Probable Submitter: 61.68.211.46
----
Manual Page -- http://www.php.net/manual/en/function.array-values.php
Edit -- https://master.php.net/note/edit/99750
Del: integrated -- https://master.php.net/note/delete/99750/integrated
Del: useless -- https://master.php.net/note/delete/99750/useless
Del: bad code -- https://master.php.net/note/delete/99750/bad+code
Del: spam -- https://master.php.net/note/delete/99750/spam
Del: non-english -- https://master.php.net/note/delete/99750/non-english
Del: in docs -- https://master.php.net/note/delete/99750/in+docs
Del: other reasons-- https://master.php.net/note/delete/99750
Reject -- https://master.php.net/note/reject/99750
Search -- https://master.php.net/manage/user-notes.php