Zend - The PHP Company




Arrays

Add Code


Two-dimensional arrays in forms  

Type: code fragment
Added by: ADMIN
Entered: 16/01/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 8741
This code will allow you to use two-dimensional arrays with forms in PHP 3


<?
while (list($key$value) = each ($foo)){
  
$keys explode('__'$key);
  
$realfoo[$keys[0]][$keys[1]] = $value;
}
?>


Usage Example


<input name="foo[a__b]">
will put the value into $realfoo["a"]["b"]


Rate This Script





Search



This Category All Categories