Ok. Another function name solved (almost) one of my problem. Thanks.
Anyway, the code below makes me confused.
function countxs($x) {
if ($x<3) {
$x++;
echo($x.", ");
countxs($x);
}
echo("<br>send: ".$x);
return $x;
}
$a = countxs(0);
echo(" ==> recived: ".$a."<br>");
It will produce an output like this:
1, 2, 3,
send: 3
send: 3
send: 2
send: 1 ==> recived: 1
I would have excpected this:
send: 3 ==> recived: 3
If I use this code instead (that's the same as in my first message, except for the function name) I get even more confused.
function countxs($x) {
if ($x<3) {
$x++;
echo($x.", ");
countxs($x);
}
else {
echo("<br>send: ".$x);
return $x;
}
}
$a = countxs(0);
echo(" ==> recived: ".$a."<br>");
It will produce an output like this:
1, 2, 3,
send: 3 ==> recived:
So, how could I get a (recursive) function that behaves as I excpect?
/Markus