I create a contact form but users send my spam content in another language (my language is Hebrew).
I try to force send english text that his percent from the total string is more than X percent (for example 10%). Here's my code:
$sent_text = 'שלום, שמי הוא דין. Hello';
$check = similar_text($sent_text, '[A-Za-z]', $percent);
echo 'percent of english is: ' . $check($percent);
I expect the output to be 20% but nothing return.