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
This script may not produce the results expected. In this script we set up our base vars ($a, $b) next we create $c and assign it the the value of ++$a, in other words 'Increment $a then put then assign $c the value'. Next we create $d and assign it the the value of $b++, in other words 'Assign $d the value of $b, then increment $b'. If we were to print this it would produce:
The speed difference comes because when you use post increment or decrement ($i++) PHP copies the value to a tmp variable, then it increments the value and returns the value which was stored before the incrementation, pre increment/decrement however does not, it just returns the value of the variable +/- 1
Anyway back to the topic, yes you are right C has no native boolean type (to my knowledge, prior to C99)
, instead you use 0 or 1 to flag true or false or you can use #define's or enum's:
I just tried it with Java, and java does not seem to compile as well.
Java doesn't allow an integer expression where by false is (int)0 and true is any non-zero value, as boolean variables are represented by the primitive type 'boolean' and java doesn't allow casting to and from boolean i believe (my java is a bit sketchy).
Awesome, by the way is Apache really neccessary? I have IIS 7 so I am just thinking to install PHP on that.
No not at all, you can install and use PHP in a variety of ways, including on a command line interface. I am not sure of how to install on IIS as i don't usually use windows that often, but I'm sure somebody on here will.
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
Last edited by sketchMedia : 07-10-2008 at 03:02 PM.
Reason: clarified a point that was a bit cloudy