try this one.. seems to easy though. Maybe I'm missing something??

<?
/* throw a few values into an array */
 
$my_arr[1]= "ichi";
$my_arr[2]= "ni";
$my_arr[3]= "san";
$my_arr[4]= "shi";
$my_arr[5]= "go";
 
/* set a variable equal to the current value in the array using pos() */
$curr_val = pos($my_arr);
 
/* set another variable equal to the current key in the array using key() */
$curr_key = key($my_arr);
 
/* for debug's sake, print the variables out */
print($curr_val."\n"); /* returns "ichi" */
print($curr_key."\n"); /* returns "1" */
 
/* now, use that key variable to change the current value */
 
$my_arr[$curr_key] = "one";
 
/* now, reprint the key directly from the array to show it's changed */
print($my_arr[$curr_key]."\n");
?>

Cheers,

Brad

On Mon, 15 Jan 2001, Catalin Borcea wrote:

> How do I modify the value of the current element of an array?
> 
> -- Catalin Borcea --
>                       \\\|///
>                      \\ - - //
>                    ( @ @ )
>  -----oOOO----(_)----OOOo----
> 
> 
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to