array keys

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

array keys

Post by malcolmboston »

I have an array that looks like this

Code: Select all

[cart] => Array
        (
            [0] => Array
                (
                    [productID] => 3
                    [productStockCode] => 72650
                    [productColour] => Dark Denim
                    [productOnlinePrice] => 119.9900
                    [productFullName] => Artful Dodger Flocked Jeans
                    [quantity] => 2
                )

        )
            [1] => Array
                (
                    [productID] => 3
                    [productStockCode] => 72650
                    [productColour] => Dark Denim
                    [productOnlinePrice] => 119.9900
                    [productFullName] => Artful Dodger Flocked Jeans
                    [quantity] => 2
                )

        )
when i delete key [0] the array starts again at 1, i want the array to start from 0 always and go up in 1's how can i do this? is there a built in function?
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

Code: Select all

$array = array_values($array);
Post Reply