vendredi 22 décembre 2017

very strange php anomaly with if operator

Very strange if operator anomaly, I check if $key == 'somestring' and then write $key to the file, the content of the file is '0'. Does anybody know what the problem is? function code:

    function check_user_inputs($block, $text) {
    //$text = format_string($text);
    //log__("1q122");
    foreach ($block as $key => $value) {
        if($key == "user_input") {
            fwrite(fopen('1.php', 'w'), $key);
            break; //may be commented
            foreach ($value as $user_input) {
                if($user_input == $text) {
                    //log__($block);
                    return $block['goto'];
                }
            }
        }elseif(is_array($value) || is_object($value)) {
            //log__('check_value - ' . $key);
            return check_user_inputs($value, $text);
        }
    }
}

the content of 1.txt file is : 0

Aucun commentaire:

Enregistrer un commentaire