当前位置: 首页>>代码示例>>PHP>>正文


PHP Converter::ToLatin方法代码示例

本文整理汇总了PHP中Converter::ToLatin方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::ToLatin方法的具体用法?PHP Converter::ToLatin怎么用?PHP Converter::ToLatin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Converter的用法示例。


在下文中一共展示了Converter::ToLatin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: comparer

function comparer($a, $b)
{
    if ($a['accuracy'] > $b['accuracy']) {
        return -1;
    }
    if ($a['accuracy'] < $b['accuracy']) {
        return 1;
    }
    if ($a['accuracy'] == $b['accuracy']) {
        $aLev = levenshtein(Converter::ToLatin($a['value']), $GLOBALS['RhymeWord']);
        $bLev = levenshtein(Converter::ToLatin($b['value']), $GLOBALS['RhymeWord']);
        if ($aLev > $bLev) {
            return 1;
        }
        if ($aLev < $bLev) {
            return -1;
        }
        return 0;
    }
}
开发者ID:bumbeishvili,项目名称:geoWords,代码行数:20,代码来源:getWordByRhyme.php

示例2: extractResult

function extractResult($filterType, $param)
{
    $arr = array();
    $servername = "localhost";
    $username = "testUser";
    $password = "testPassword";
    $dbname = "geoWords";
    // Create connection
    $mysqli = new mysqli($servername, $username, $password, $dbname);
    /* check connection */
    if (mysqli_connect_errno()) {
        printf("Connect failed: %s\n", mysqli_connect_error());
        exit;
    }
    if (!$mysqli->set_charset("utf8")) {
        printf("Error loading character set utf8: %s\n", $mysqli->error);
        exit;
    }
    $query = "select word_geo from words where word_eng " . $filterType . " ? ";
    if ($stmt = $mysqli->prepare($query)) {
        $param = Converter::ToLatin($param);
        $stmt->bind_param("s", $param);
        /* execute statement */
        $stmt->execute();
        // bind result variables
        $stmt->bind_result($word_value);
        $counter = 0;
        //fetch values
        while ($stmt->fetch()) {
            if ($counter++ > 999) {
                break;
            }
            array_push($arr, array('id' => $counter, 'value' => $word_value));
        }
        /* close statement */
        $stmt->close();
    }
    $mysqli->close();
    return $arr;
}
开发者ID:Nika-Ts,项目名称:geoWords,代码行数:40,代码来源:common.php

示例3: extractResult

function extractResult($filterType, $param)
{
    $arr = array();
    $query = "select word_geo from words where word_eng " . $filterType . " ? ";
    $mysqli = getMysqli();
    $stmt = getStatementByQueryFromMysqli($query, $mysqli);
    $param = Converter::ToLatin($param);
    $stmt->bind_param("s", $param);
    /* execute statement */
    $stmt->execute();
    // bind result variables
    $stmt->bind_result($word_value);
    $counter = 0;
    //fetch values
    while ($stmt->fetch()) {
        if ($counter++ > 999) {
            break;
        }
        array_push($arr, array('id' => $counter, 'value' => $word_value));
    }
    closeConnections($stmt, $mysqli);
    return $arr;
}
开发者ID:bumbeishvili,项目名称:geoWords,代码行数:23,代码来源:common.php

示例4: vowelsCount

<?php

include 'common.php';
$param = $_GET['template'];
$string = Converter::ToLatin($param);
echo $param . '<br>';
echo "<br>";
$vowelsCount = vowelsCount($string);
$rhymeLevel1Regex = '$';
$rhymeLevel2Regex = '$';
$rhymeLevel3Regex = '$';
$rhymeLevel4Regex = '$';
$rhymeLevel5Regex = '$';
$rhymeLevel6Regex = '$';
$splitedArray = splitBackPartByVowel($string);
print_r($splitedArray);
if ($vowelsCount > 0) {
    $ConsonantReplacer1 = "";
    $ConsonantReplacer2 = "";
    $ConsonantReplacer3 = "";
    $ConsonantReplacer4 = "";
    $ConsonantReplacer5 = "";
    $ConsonantReplacer6 = "[^aeiou]*";
    if ($splitedArray[5] != '') {
        $ConsonantReplacer1 = $splitedArray[5];
        $ConsonantReplacer2 = "";
        $ConsonantReplacer3 = "";
        $ConsonantReplacer4 = "";
        $ConsonantReplacer5 = "";
    }
    $rhymeLevel1Regex = $splitedArray[4] . $ConsonantReplacer1 . $rhymeLevel1Regex;
开发者ID:Nika-Ts,项目名称:geoWords,代码行数:31,代码来源:getWordByRhyme.php


注:本文中的Converter::ToLatin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。