//The word is an isogram, if a key given in this word is repeated more than ONCE
echo isIsogram("Password")."\n";
echo isIsogram_2("Tkemaladze")."\n";
//Using isset function
function isIsogram($str){
	$str=strtolower($str);//turn to lower case
	$len=strlen($str);//count lenght of word array
	$array=[];//create new array
	for ($i=0; $i<$len; $i++){
		if (!isset($array[$str[$i]])){
			$array[$str[$i]]=true;
		}else{
			return false;
		}
	}
	return true;
}
//usinf in-array function
function isIsogram_2($str){
	$str=strtolower($str);//turn to lower case
	$len=strlen($str);//count lenght of word array
	$array=[];//create new array
	for ($i=0; $i<$len; $i++){
		if (in_array($str[$i], $array)){
			return true;
		}else{
			$array[]=$str[$i];
		}
	}
	return true;
}
by ვაჟა ტყემალაძე
2 years ago
PHP
Problem Solving
php
Note
Problem
0
Pro tip: use ```triple backticks around text``` to write in code fences