Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Pętla - gdzie błąd?
Przemo_
post
Post #1





Grupa: Zarejestrowani
Postów: 62
Pomógł: 1
Dołączył: 12.06.2007

Ostrzeżenie: (0%)
-----


Witam.

Mam oto taki kod

  1. <?php
  2. function udb_hash($string){
  3.  
  4. for(new x=0; x < strlen($string); x++){
  5.  
  6. $string[x] += (3^x) * (% 15);
  7. if($string[x] > (0xff)){
  8.  $string[x] -= 256;
  9.  }
  10.  }
  11.  }
  12. ?>


Gdy wchodzę na stronę, gdzie jest ta funkcja wyskakuje mi błąd

Kod
Parse error: syntax error, unexpected '=', expecting ';' in reg.php on line 16


Mógłbym mi ktoś powiedzieć, albo dać wskazówki dlaczego takowy błąd występuje ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Cezar708
post
Post #2





Grupa: Zarejestrowani
Postów: 1 116
Pomógł: 119
Dołączył: 10.05.2005
Skąd: Poznań

Ostrzeżenie: (0%)
-----


to działa dokładnie tak jak tamten algorytm, tyle że ten pod php.

  1. <?php
  2. function udb_hash($string) {
  3. $aString = str_split($string);
  4. $return = '';
  5. foreach ($aString as $x => $l){
  6. $int = ord($l) + pow(3, $x) * ($x % 15);
  7. if ($int > 255) {
  8. $int -= 256;
  9. }
  10. $return .= chr($int);
  11. }
  12. return $return;
  13. }
  14. echo udb_hash($pass);
  15. ?>


Pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 11.10.2025 - 02:34