English 中文(简体)
在不同体系中形成同样的结果
原标题:Generating same result with bindec on different systems

如果有可能在不同系统中产生与约束性方法相同的结果,我很奇怪。

事情是,我的职能(使用捆绑式方法)在我的Windows 7 64借机上测试时运作得很好,但在我向我的网络服务器(操作班轮)传送该代码时,我取得了不同的结果。 我将问题缩小到了约束性方法,因此我知道,它正在造成这一问题。

Thanks, Rob

这里是这一职能。 我需要XOR运营商,但这给我的机器和我的服务器带来了不同的结果,因此我自己写道,这是否可行。

function MyXOR($input, $key){
    $bin_data = decbin($input);
    $bin_key = decbin($key);
    $result_string = "";
    $len_data = strlen($bin_data);
    $len_key = strlen($bin_key);
    for($i = 0; $i < $len_data; $i++){
        if($bin_data{$i} == $bin_key{$i % $len_key}){
                $result_string .= 0;
            } else {
                $result_string .= 1;
        }
    }

    return bindec($result_string);
}
问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签