1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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