note 98180 added to function.print

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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))
----
Server IP: 85.214.154.209
Probable Submitter: 62.225.230.98
----
Manual Page -- http://www.php.net/manual/en/function.print.php
Edit        -- https://master.php.net/note/edit/98180
Del: integrated  -- https://master.php.net/note/delete/98180/integrated
Del: useless     -- https://master.php.net/note/delete/98180/useless
Del: bad code    -- https://master.php.net/note/delete/98180/bad+code
Del: spam        -- https://master.php.net/note/delete/98180/spam
Del: non-english -- https://master.php.net/note/delete/98180/non-english
Del: in docs     -- https://master.php.net/note/delete/98180/in+docs
Del: other reasons-- https://master.php.net/note/delete/98180
Reject      -- https://master.php.net/note/reject/98180
Search      -- https://master.php.net/manage/user-notes.php
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.