AW: [PHP-DB] recursion

From: Date: Tue, 30 Jan 2001 08:37:57 +0000
Subject: AW: [PHP-DB] recursion
Groups: php.db 
Request: Send a blank email to php-db+get-6252@lists.php.net to get a copy of this message
Hi Andrew, This works fine: // Prints out an array recursiv function print_array( $array, $seperator = "" ) { while ( list( $key, $val ) = each($array) ) { if ( is_array( $val ) ) { print_array( $val, $seperator." => ".$key ); } else { echo "$seperator => $key => $val<BR>\n"; } } echo "<BR>\n"; } Hope this helps. BTW: the [PHP-DB]-List isn't the right one for this question =8) Greetinx, Mike (Germany) -----Ursprungliche Nachricht----- Von: Andrew [mailto:kozak@ps.kiev.ua] Gesendet: Dienstag, 30. Januar 2001 09:18 An: PHP-DB Betreff: [PHP-DB] recursion Hi, Does PHP4 support recursive function ivocation? It seemed tome that it does not, because the code below doesn't work properly. function RecPrintDeps($arr, $depth=0){ //print_r($arr); $depth++; printf("<H$depth><a href=\"%s?dep=%s\">%s</a></H$depth>", $HTTP_SELF, $arr[0], $arr[2]); while(list($k,$v)=each($this->$deptree)){ if($v[1]==$arr[0]) $this->RecPrintDeps($v,$depth); } } The function is a member of a class. Regards, Andrew Kozachenko Programmer Ukraine International Airlines -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#6252) next »