Page 1 of 1

array issue

Posted: Tue Dec 05, 2006 1:40 am
by itsmani1
i want to remove element form array and what i know is '14937777' or '14547812', that's all, can i remove array form main array?

Code: Select all

Array
(
    [14547812] => Array
        (
            [0] =>  
            [1] => Orch
            [2] => Z
            [3] => 245
        )

    [14937777] => Array
        (
            [0] =>  
            [1] => 140
            [2] => I
            [3] => 685
        )
)

Posted: Tue Dec 05, 2006 2:05 am
by volka

Posted: Tue Dec 05, 2006 2:27 am
by itsmani1
it simply unseats whole array:
you can see there are two array in one array, i want to remove one of them not the whole array.

Posted: Tue Dec 05, 2006 3:17 am
by volka
Please, take a closer look at example 1 of http://de3.php.net/unset[quote]// destroy a single element of an array[/quote]

Posted: Tue Dec 05, 2006 4:48 am
by dibyendrah

Code: Select all

<?php
$var = array(0=>array('x', 'y', 'z'), 1=>array('a', 'b', 'c'));
print_r($var);
unset($var[0][0]);
print_r($var);
?>
Output :

Code: Select all

Array
(
    [0] => Array
        (
            [0] => x
            [1] => y
            [2] => z
        )

    [1] => Array
        (
            [0] => a
            [1] => b
            [2] => c
        )

)
Array
(
    [0] => Array
        (
            [1] => y
            [2] => z
        )

    [1] => Array
        (
            [0] => a
            [1] => b
            [2] => c
        )

)
Hope you have an idea now. :wink:

Posted: Tue Dec 05, 2006 5:35 am
by itsmani1
thanks dibyendrah.