Re: Simple array question, array delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Apr 6, 2005 3:27 PM, Ken <kenkam@xxxxxxxxx> wrote:
> 
> On Apr 6, 2005 3:09 PM, Ryan A <ryan@xxxxxxxxxxxx> wrote:
> 
> > Hey,
> > I have a $data_recs array like this:
> > 
> > 12
> > 445
> > 45655
> > 4
> > 3466663
> > etc
> > 
> > when the user gives me a number, i have to check if its in the array and
> > delete that entry...how do i do that?
> > I have looked at the manual but have gotten confused with array
> > pop,splice,array_key_exists etc
> > 
> > Thanks,
> > Ryan
> > 
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005
> > 
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> foreach ($array as $key=>$value)
> {
> if(strpos($value, $userValue)
> {
> unset($array['$key']);
> }
> }
> 
> i believe... not sure if it works or not
> 
> hope this helps
> 
> 
> 
sorry the if bit is not strpos
if ($value == $userValue)
{
// the unset part here
}

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux