accesing array elements

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
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

accesing array elements

Post by pelegk2 »

i have an array like this :

Code: Select all

<?php
Array(
    [006] => Array
        (
            [0] => 146
            [1] => 1
        )

    [016] => Array
        (
            [0] => 157
            [1] => 1
        )

    [018] => Array
        (
            [0] => 150
            [1] => 1
        )

    [019] => Array
        (
            [0] => 158
            [1] => 1
        )

)
?>
why can i access an element like this :
myArr[006] ???
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why can you? because that array element exists.. IIRC, a leading zero will tell the core you want an octal number.. so you may want to turn those into strings.
Post Reply