note 98180 deleted from function.print by visualmind

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: yuwas at ht dot cx 

----

For a recursive output of a multi-layer array, the following could be a solution:
<?php
function arr_render($arr){
  if(is_array($arr)){
    for($i =0, $result ='array('; $i < count($arr) -1; $i++){
      $result .=arr_render($arr[$i]) .',';
    };
    $result .=arr_render($arr[$i]) .')';
    return($result);
  }else{
    return((string) $arr);
  };
};
$neighbourhood =array('Cheap Choice Center', array('Smith', 'Sally', 'sheep'), 'Packet Plus Postal Point', array(array('Mr. Mirst', 'Mrs. Mirst'),'Great Grocery'));
print(arr_render($neighbourhood));
?>

The result: array(Cheap Choice Center,array(Smith,Sally,sheep),Packet Plus Postal Point,array(array(Mr. Mirst,Mrs. Mirst),Great Grocery))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.