post or pre incrementing/decrementing depends on what you need the script to do, both can produce very different results, consider this:
PHP Code:
<?php
$a = $b = 1;
$c = ++$a;
$d = $b++;
printf('$a: %d <br /> $b: %d <br /> $c: %d <br /> $d: %d',$a, $b, $c, $d);
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:
Code:
#define TRUE 1
#define FALSE 0
//or
typedef enum { FALSE, TRUE } boolean;
or user C99's stdbool:
c Code:
#include<stdbool>
bool boolean = true;
//etc
However php considers all these values as (Boolean)FALSE:
taken from: PHP: Booleans - Manual