From a698d44b7aed462cc7f179a01c917426db3b724a Mon Sep 17 00:00:00 2001 From: ELmardi2 Date: Tue, 12 Jul 2016 14:53:38 +0200 Subject: [PATCH] first --- wordy.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/wordy.php b/wordy.php index 4a2c5ce..ed07a82 100644 --- a/wordy.php +++ b/wordy.php @@ -4,10 +4,14 @@ // This is only a SKELETON file for the "Hello World" exercise. // It's been provided as a convenience to get you started writing code faster. // - -function calculate($question = "") -{ - // - // YOUR CODE GOES HERE - // + function HammingDistance($x, $y) { + $a1 = str_split($x); + $a2 = str_split($y); + $dh = 0; + for ($i = 0; $i < count($a1); $i++) + if($a1[$i] != $a2[$i]) $dh++; + return $dh; } + +echo HammingDistance('GAGCCTACTAACGGGAT,CATCGTAATGACGGCCT'); + ?>