Posted By

nicolaspar on 08/09/07


Tagged

ofuscar encodear esconder encoder


Versions (?)

PHP - Ofuscar Valor


 / Published in: PHP
 

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

  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  

You need to login to post a comment.