Page 1 of 1

array questions.

Posted: Thu Jan 22, 2004 12:34 pm
by lizlazloz
ok, first this sounds really noobish, but say i have an array, and i want to find if any of the elements in the array have a specified value, how would i do that?

secondly, how would i remove an element from an array?

Posted: Thu Jan 22, 2004 12:38 pm
by markl999

Posted: Thu Jan 22, 2004 12:52 pm
by infolock

Code: Select all

for($i=0; $i<count($myarray); $i++)
{
   if ($myarray[$i] = 'some value')
   {
        // Do something
   }
}
in place of Do something, you could redefine that array to be something else

$myarray[$i] = 'this string';

hope this helps.