Hi internals,

So this code:

    <?php

    declare(strict_types=1);

    $i = true;
    $i++;
    var_dump($i);
    $i--;
    var_dump($i);


    $i = false;
    $i++;
    var_dump($i);
    $i--;
    var_dump($i);

outputs:

    bool(true)
    bool(true)
    bool(false)
    bool(false)

which is quite surprising on multiple levels.

Does anyone know if this behaviour is deliberate, or is it just an
oversight that could have an RFC applied to it?

cheers
Dan
Ack

btw I realised that the behaviour is like it is, from someone asking
for help debugging this code:

<?php
$i=0;
$j=2;
$exit = 0;
while(10-$i++||$i=0||--$j){
    echo$i.' - '.$j."\n";
    if($exit++ == 30) exit();
}

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to