minte9
LearnRemember



Increment

If the operator is placed after its operand, the interpreter will first return the value.
 
/**
 * If the operator is placed after its operand, 
 * the interpreter will first return the value.
 * 
 * Incrementing or decrementing booleans has no effect.
 */

$a = 1;
echo $a++; // 1
echo ++$a; // 3

$b = true;
var_dump(++$b == true); // true
var_dump($b++ == true); // true

Chars

Arithmetics on chars follows Perl's convention.
 
/**
 * Arithmetics on chars follows Perl's convention
 */

$i = 'W';
for ($n=0; $n<6; $n++) {
    echo ++$i . " "; // X Y Z AA AB AC 
}



  Last update: 233 days ago