![]() |
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:
I've attempted to code it to make it easier for you guys to copy and paste: Code:
<?PHP |
Install PHP! It's actually fairly easy. Download Apache, download PHP, off you go.
PHP considers true and false 1 and 0 respectively as well, and the script stops at 0. -m |
OR you can be lazy and install WampServer2 and I'm pretty sure php supports $x-- and --$x the latter being the faster.
|
post or pre incrementing/decrementing depends on what you need the script to do, both can produce very different results, consider this:
PHP Code:
Code:
2Anyway 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: Code:
#define TRUE 1c Code:
|
Thanks for the answers.
.NET is unable to do it because of strong types. It will not compile because "int can not be converted to boolean". I just tried it with Java, and java does not seem to compile as well. Awesome, by the way is Apache really neccessary? I have IIS 7 so I am just thinking to install PHP on that. |
Quote:
Quote:
|
How to install PHP on IIS: BillS IIS Blog
How To Install IIS 7, PHP5 and MySQL 5.1 on Windows Server 2008 - Part 2 ...seems to make it sound fairly simple. -m |
| All times are GMT. The time now is 03:10 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0