note 27281 added to function.is-array
| From: | vh1 at punkhardcore dot net | Date: | Sat, 30 Nov 2002 14:52:19 +0000 |
| Subject: | note 27281 added to function.is-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40145@lists.php.net to get a copy of this message | ||
just in case you have:
<input type=text name="cookie[name]">
<input type=text name="cookie[life]">
<input type=text name="admin[username]">
<input type=text name="admin[password]">
try this:
while(list($key,$val) = each($_POST)){
$parent = $key;
if(is_array($val)){
while(list($key,$vall) = each($val)){
$config .= "$".$parent."[$key] =\t\t\"$vall\"\n";
}
}
}
print nl2br($config);
this will display all your values as '$parent[$key] = "$value\n"'
for easy creation of a file or something like that, hopes it helps
--
http://www.php.net/manual/en/function.is-array.php
http://master.php.net/manage/user-notes.php?action=edit+27281
http://master.php.net/manage/user-notes.php?action=delete+27281
http://master.php.net/manage/user-notes.php?action=reject+27281