Example , Recursive functions on PHP

<?php
function recursion($a)
{
if ($a < 20) {
echo "$a\n";
recursion($a + 1);
}
}
?>

Example , Functions within functions

<?php
function foo()
{
function bar()
{
echo "I don't exist until foo() is called.\n";
}
}

/* We can't call bar() yet
since it doesn't exist. */

foo();

/* Now we can call bar(),
foo()'s processesing has
made it accessible. */

bar();

?>