PHP - Ofuscar Valor


/ Published in: PHP
Save to your folder(s)

$test = 'hola';
echo $test ."";
$test = ofuscar( $test ); #Ida
echo $test ."";
$test = ofuscar( $test ); #Vuelta
echo $test ."";


Copy this code and paste it in your HTML
  1. function ofuscar( $str ){
  2. $total = strlen ($str); $salida = "";
  3. for ($i = 0 ; $i < $total; $i++) {
  4. $j= ord( substr ($str, $i, 1) ) ;
  5. $j= $j ^ $i ;
  6. $salida .= chr($j);
  7. }
  8. return $salida;
  9. }
  10. $test = 'hola';
  11. echo $test ."<hr>";
  12. $test = ofuscar( $test ); #Ida
  13. echo $test ."<hr>";
  14. $test = ofuscar( $test ); #Vuelta
  15. echo $test ."<hr>";

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.