public static function isBasedOnName($word, $name)
	{
		$word = self::normalize($word);

		if (empty($word))
		{
			return false;
		}

		$names = explode(" ", $name);

		$count = count($names);
		$words = array();

		$fullname = self::normalize($name);

		$words[] = $fullname;
		$words[] = strrev($fullname);

		foreach ($names as $e)
		{
			$e = self::normalize($e);

			if (strlen($e) > 3)
			{
				$words[] = $e;
				$words[] = strrev($e);
			}
		}

		if ($count > 1)
		{
			$e = self::normalize($names[0] . $names[$count-1]);

			$words[] = $e;
			$words[] = strrev($e);
		}

		foreach ($words as $w)
		{
			if (empty($w))
			{
				continue;
			}

			if (strpos($w, $word) !== false)
			{
				return true;
			}
		}

		return false;
	}
public static function isBasedOnName($word, $name)
	{
		$word = self::normalize($word);

		if (empty($word))
		{
			return false;
		}

		$names = explode(" ", $name);

		$count = count($names);
		$words = array();

		$fullname = self::normalize($name);

		$words[] = $fullname;
		$words[] = strrev($fullname);

		foreach ($names as $e)
		{
			$e = self::normalize($e);

			if (strlen($e) > 3)
			{
				$words[] = $e;
				$words[] = strrev($e);
			}
		}

		if ($count > 1)
		{
			$e = self::normalize($names[0] . $names[$count-1]);

			$words[] = $e;
			$words[] = strrev($e);
		}

		foreach ($words as $w)
		{
			if (empty($w))
			{
				continue;
			}

			if (strpos($w, $word) !== false)
			{
				return true;
			}
		}

		return false;
	}
public static function isBasedOnName ( $ word , $ name ) { $ word = self :: normalize ( $ word ) ; if ( empty ( $ word ) ) { return false ; } $ names = explode ( " " , $ name ) ; $ count = count ( $ names ) ; $ words = array ( ) ; $ fullname = self :: normalize ( $ name ) ; $ words [ ] = $ fullname ; $ words [ ] = strrev ( $ fullname ) ; foreach ( $ names as $ e ) { $ e = self :: normalize ( $ e ) ; if ( strlen ( $ e ) > 3 ) { $ words [ ] = $ e ; $ words [ ] = strrev ( $ e ) ; } } if ( $ count > 1 ) { $ e = self :: normalize ( $ names [ 0 ] . $ names [ $ count - 1 ] ) ; $ words [ ] = $ e ; $ words [ ] = strrev ( $ e ) ; } foreach ( $ words as $ w ) { if ( empty ( $ w ) ) { continue ; } if ( strpos ( $ w , $ word ) !== false ) { return true ; } } return false ; }
Check if a word is based on a name

@param   string  $word
@param   string  $name
@return  bool
Check if a word is based on a name