Re: Recursive Threading with PHP and MySQL.
| From: | Chris Lee | Date: | Thu, 06 Dec 2001 00:18:08 +0000 |
| Subject: | Re: Recursive Threading with PHP and MySQL. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76806@lists.php.net to get a copy of this message | ||
recursion is something that can be fun and practical at times, other times
its a bad coder trying to do something they think is clever. use it wisly.
<?php
function power($num, $power = 1)
{
if ($num != 2)
$power = power(($num/2), $power+1);
return $power;
}
echo power(16);
?>
this example is purposely coded bad to show you how recursion can mess up
with bad error checking. this example will work. change to power(30) and
you'll get a segfault because $num will allways equal anything but 2. this
gives you a starting point on recursion.
--
Chris Lee
lee@mediawaveonline.com
"Alawi" <albaity@php4web.com> wrote in message
news:002201c17dc2$75276cd0$753f47d4@mcsh2l7jqy8bgj...
I want to know how can i do that Recursive loop to get categories as example
can any body help me by give my tutorial or any thing to understand this
techniqe