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:[EMAIL PROTECTED]]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]