Q:

My script does not working correctly it starts and not stop after it

I am working on a function, but that function is not working properly when 
I run it, then it runs continuously.
I didn't find where is actual problem is.
<?php  

    function recursion($a) {

        if($a < 20) {   
            echo "$a\n";    
            recursion($a);
        }

    }  

    $a = 2; 
    recursion($a);      
    echo "</br>";  

?>

A:

Your recursion function going to infinite because you are passing same value again and again with recursion($a); so if($a<20) will be always result true and recursion won't break ever. 
Try increment ++$a or $a += 1 or $a = $a+1.
recursion(++$a);//increasing value with prefix operator ++

Complete code:
function recursion($a) {
    if($a < 20) {   
        echo "$a\n";    
        recursion(++$a);
    }
}  
$a = 2; 
recursion($a);      
echo "</br>";

Output:

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

