<?php $strings[] = 'sixty yards out'; $strings[] = 'seventy five yards out'; $strings[] = 'one hundred fifty yards out'; $inputString = 'seventy two yards out'; $p = 0; $k = null; foreach ($strings as $key => $string) { similar_text($inputString, $string, $percent); if ($percent > $p) { $p = $percent; $k = $key; } } echo $k ? $strings[$k] : "";
You have javascript disabled. You will not be able to edit any code.