Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   parsing array. (http://www.go4expert.com/forums/parsing-array-t22772/)

gsingla4u 21Jul2010 15:43

parsing array.
 
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.


gsingla4u 21Jul2010 16:27

Re: parsing array.
 
i have done it myself.
thanx :)


All times are GMT +5.5. The time now is 13:17.