Look at array_splice()

Something like $new_array=array_splice($ar,3,1) should return

$new_array[0]="a"
$new_array[1]="b"
$new_array[2]="d"
$new_array[3]="e"
$new_array[4]="f"
$new_array[5]="g"

Cheers
Garth
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
On Behalf Of David Busby
Sent: Friday, 3 January 2003 10:25 AM
To: [EMAIL PROTECTED]
Subject: PHP Code Question


List,
    Suppose you have an array in PHP like

$ar = array("a", "b", "c", "d", "e", "f", "g");

Now say you want to remove the 3rd item

unset($ar[2]);

All good?  Not really...the array doesn't get shifted down, how could
one pull that off (or should I spin the array and recreate without the
undesired values?

/B


David Busby
Systems Engineer
[EMAIL PROTECTED]



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.435 / Virus Database: 244 - Release Date: 30/12/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.435 / Virus Database: 244 - Release Date: 30/12/2002
 



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to