user3367150
user3367150

Reputation: 1

Cannot redeclare hash()

<?php
function hash($val, $key){
    $chrs = explode($val, "");
    for($c=0; $c<count($chrs); $c++){
          $ascii[$c]=ord($chrs[$c]);
    }
    $digi = explode($key,"");
    for($c=0; $c<count($digi); $c++){
        $nascii[$c]= $ascii[$c]+$digi[$c];
        $fhash[$c] = $nascii[$c];
    }
}
?>

Fatal error: Cannot redeclare hash() in /Applications/XAMPP/xamppfiles/htdocs/hash.php on line 12

What is wrong with my simple php code?

Upvotes: 0

Views: 75

Answers (1)

Rikesh
Rikesh

Reputation: 26421

hash() is already a PHP inbuilt function. Name your function to something else.

Upvotes: 3

Related Questions