/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /*---------------------------------------------------------------------------- PhpDiceCoeff - An Implementation of the Dice-Coefficient in PHP Version 0.0.01a (C)2010 by Emil Endgut ============================================================== This is Friendware, which means that you may use it as if you wrote it, after you became a friend of mine on Facebook. Please Visit: http://www.facebook.com/profile.php?id=100001062124472 ============================================================== Usage: php dice.php "stringA" "stringB" ----------------------------------------------------------------------------*/ $str_a =$argv[1]; $str_b =$argv[2]; echo "dice(\"".$str_a . "\", \"". $str_b. "\") = " . dice($str_a, $str_b) . "\n"; function dice($a, $b) { $az=zerleg($a); $bz=zerleg($b); return 2 * $ic / ($ac + $bc); } function zerleg($str) { for($n=2;$n<$len;$n++) for($i=0 ; $i+$n<=$len ; $i++) return $arr; } ?>