<?php error_reporting(4); class lovecalc { function lovecalc ($firstname, $secondname) { $this->lovename = strtolower(preg_replace("/ /","",strip_tags(trim($firstname.$secondname)))); $alp = count_chars($this->lovename); for($i=97;$i<=122;$i++){ if($alp[$i]!=false){ $anz = strlen($alp[$i]); if($anz<2){ $calc[] = $alp[$i]; } else{ for($a=0;$a<$anz;$a++){ $calc[] = substr($alp[$i],$a,1); } } } } while (($anzletter = count($calc))>2) { $lettermitte = ceil($anzletter/2); for($i=0;$i<$lettermitte;$i++){ $sum = array_shift($calc)+array_shift($calc); $anz = strlen($sum); if($anz<2){ $calcmore[] = $sum; } else{ for($a=0;$a<$anz;$a++){ $calcmore[] = substr($sum,$a,1); } } } $anzc = count($calcmore); for($b=0;$b<$anzc;$b++){ $calc[] = $calcmore[$b]; } array_splice($calcmore,0); } $this->lovestat = $calc[0].$calc[1]; } function showlove () { return "Mevcut Sevgi : %$this->lovestat"; } } //örnek kullanım ?> <html> <body> <form action="" method="get"> Sen<input type="text" name="you" value="<?php echo @$_GET['you']; ?>"/> Ben<input type="text" name="me" value="<?php echo @$_GET['me']; ?>"/> <input type="submit" name="send" value="Hesapla"/> </form> </body> </html> <?php $my_love = new lovecalc(@$_GET['you'],@$_GET['me']); echo $my_love->showlove(); ?>