Disclaimer : This Code is Just for fun.Code is basically Simple random words weight and find percentage, we are sorry if someone percentage is low as they are expecting.if you use our code in own website please Support our site.
Program :
<?php function name_numbers($name){ $total = 0; foreach (str_split($name) as $key => $value) { $ascii = ord($value)-20; $total = $total + $ascii; } return $total; } function lovelevel($percent){ if($percent<=20) return "Enemy"; else if($percent>20&&$percent<=50) return "Just Friends"; else if($percent>50&&$percent<=80) return "Crush"; else if($percent>80&&$percent<=90) return "Love Birds"; else return "True Lovers"; } function friendlevel($percent){ if($percent<=20) return "Friend Circle"; else if($percent>20&&$percent<=50) return "Just Friends "; else if($percent>50&&$percent<=80) return "Good Best Friends"; else return "Best Friends"; } $person1 = "Arvind"; $person2 = "Ahir"; $sum1= name_numbers($person1); $sum2= name_numbers($person2); $total_1 = strlen($person1); $total_2 = strlen($person2); $total = (($sum1+$sum2+100)/($total_1+$total_2)); // random algorithm no rule of physics,chemistry,biology if($total>101 && $total<201){ $total-=100; } $total= round($total,1); echo " $person1 ♥ $person2 Total Percentage = $total% ".lovelevel($total); ?>
Demo
(Visited 802 times, 1 visits today)
Written by: