Recursion Lecture


Recursion:recusion

Recursion is the process of repeating items in a self-similar way.(wikipedia)

Recursion In PhP:

A function call itself is known as recursion in php.
Mostly in php if-else is used for breaking recursion function.

Simple Example:

ABC(1);
function ABC($E)
{
echo $E." |";
ABC(1);
}

In the above Example a simple function ABC() created .Where i give $E=1 and when browser/Compiler Enters in the function it will print 1 again and again until the browser show an Allowed memory size error.

Because when you call ABC() function inside in the funtion it Prints $E value which is 1 in this case .And after that you can see that we again call the funtion ABC() and it will again call itself again and again.

recursion error

Most important thing recursion is also use for making viruses.

Advertisements

It's Great To Hear From You

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s