Page 1 of 1
replace a array value
Posted: Sat Jan 17, 2004 8:35 pm
by dull1554
say i have this array
Code: Select all
Array
(
[0] => one
[1] => two
[2] => three
[3] => four
[4] => five
[5] => six
)
how would i replace the value of array['2'] with 3 ??????
Posted: Sat Jan 17, 2004 9:11 pm
by dull1554
i got it, it was answered elsewhere
Posted: Sat Jan 17, 2004 9:11 pm
by Gen-ik
You haven't given the array a name so I'm a bit confused.
Code: Select all
<?php
$myArray = array("one","two","three","four","five","six");
// Change value [2] to 3
$myArray[2] = 3;
// OR... Give value [2] the value of [3]
$myArray[2] = $myArray[3];
?>
Hope that helps.
Posted: Sat Jan 17, 2004 9:26 pm
by dull1554
well its ok i really was not thinking, but i got it now, thanks Gen-ik