07-10-2008, 03:00 AM
|
#1 (permalink)
|
|
The Contributor
Join Date: Mar 2008
Posts: 31
Thanks: 1
|
quick question regarding c and php.
I know a bit of C and Kalle here (whos on the php team) has shown me some useful c source!
Just wondering since I am a .net developer (and I dont have PHP installed)
what would the following C code converted to PHP yield?
Code:
main()
{
int x = 10;
while(x) {
x--;
printf("X Value: %d\n", x);
}
}
I've attempted to code it to make it easier for you guys to copy and paste:
Code:
<?PHP
$x = 10;
while ($x)
{
$x = $x - 1;
echo $x
}
?>
My question is will the PHP code be stuck in a infinite loop? I ask because C code parses true and false as 1 and 0, and therefore when that "x" value eaches zero, its assumed "false" and the while loop exits
|
|
|
|