Obfuscating string values in PHP source code

后端 未结 3 778
悲哀的现实
悲哀的现实 2021-01-24 17:36

I want to protect PHP source code at easy way.

here is a example.

 $a = \"\\x46\\122\" . chr(578813952>>23) . \"\" . chr(0105) . \"\\x2d\"; 
 $b =          


        
3条回答
  •  无人及你
    2021-01-24 18:25

    ord will get you a character's ASCII value, using that we can generate the 3 things you want.

    Type 1: Use dechex to convert int to hex.

    $chr = 's';
    $hex = dechex(ord($chr)); // 73
    

    Type 2: Use decoct to convert into to octal.

    $chr = 'E';
    $oct = decoct(ord($chr)); // 105
    

    Type 3: Use the << (shift left) operator.

    $chr = 'e';
    $bin = ord($chr)<<23; // 847249408
    

提交回复
热议问题