parsing array.

Discussion in 'PHP' started by gsingla4u, Jul 21, 2010.

  1. gsingla4u

    gsingla4u New Member

    Joined:
    Jul 27, 2009
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    i have to put all the elements of a multidimensional array in a single array.
    i have written the code but there is some problem with it.
    Here it is:
    Code:
    <?php
        function parsearray($ary){
            $newArray=array();
            foreach($ary as $val){
                if(is_array($val)){
                    parsearray($val);
                }else{
                    $newArray[]=$val;
                }
            }
        return $newArray;
        }
        $array=array(2,3,89,34,array(90,1,43));
        $chk=parsearray($array);
        print_r    ( $chk);
    ?>
    
    also i want a function that search all the elements of multidimensional array and find the biggest one.
    
    Thank you.
    
     
  2. gsingla4u

    gsingla4u New Member

    Joined:
    Jul 27, 2009
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    i have done it myself.
    thanx :)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice