• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_last_key函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_last_key函数的典型用法代码示例。如果您正苦于以下问题:PHP get_last_key函数的具体用法?PHP get_last_key怎么用?PHP get_last_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: get_next_key

function get_next_key($key = null, $tail = '')
{
    global $range, $trans;
    // bad
    if ($key === null) {
        $key = get_last_key();
    }
    if (empty($key)) {
        return "a{$tail}";
    }
    $keylen = strlen($key);
    $last_char = $key[$keylen - 1];
    if ($last_char != '9') {
        return substr($key, 0, $keylen - 1) . $range[$trans[$last_char] + 1] . $tail;
    } else {
        return get_next_key(substr($key, 0, -1), "a{$tail}");
    }
}
开发者ID:Gninety,项目名称:Microweber,代码行数:18,代码来源:controller.php


示例2: adjust_autoincr

                    adjust_autoincr('archivedtexts', 'AtID');
                    runsql("DELETE archtexttags FROM (archtexttags LEFT JOIN archivedtexts on AgAtID = AtID) WHERE AtID IS NULL", '');
                    $message = 'Unarchived Text(s): ' . $count;
                }
            }
        }
    }
}
// DEL
if (isset($_REQUEST['del'])) {
    $message = runsql('delete from archivedtexts where AtID = ' . $_REQUEST['del'], "Archived Texts deleted");
    adjust_autoincr('archivedtexts', 'AtID');
    runsql("DELETE archtexttags FROM (archtexttags LEFT JOIN archivedtexts on AgAtID = AtID) WHERE AtID IS NULL", '');
} elseif (isset($_REQUEST['unarch'])) {
    $message2 = runsql('insert into texts (TxLgID, TxTitle, TxText, TxAudioURI) select AtLgID, AtTitle, AtText, AtAudioURI from archivedtexts where AtID = ' . $_REQUEST['unarch'], "Texts added");
    $id = get_last_key();
    runsql('insert into texttags (TtTxID, TtT2ID) select ' . $id . ', AgT2ID from archtexttags where AgAtID = ' . $_REQUEST['unarch'], "");
    splitText(get_first_value('select TxText as value from texts where TxID = ' . $id), get_first_value('select TxLgID as value from texts where TxID = ' . $id), $id);
    $message1 = runsql('delete from archivedtexts where AtID = ' . $_REQUEST['unarch'], "Archived Texts deleted");
    $message = $message1 . " / " . $message2 . " / Sentences added: " . get_first_value('select count(*) as value from sentences where SeTxID = ' . $id) . " / Text items added: " . get_first_value('select count(*) as value from textitems where TiTxID = ' . $id);
    adjust_autoincr('archivedtexts', 'AtID');
    runsql("DELETE archtexttags FROM (archtexttags LEFT JOIN archivedtexts on AgAtID = AtID) WHERE AtID IS NULL", '');
} elseif (isset($_REQUEST['op'])) {
    // UPDATE
    if ($_REQUEST['op'] == 'Change') {
        $message = runsql('update archivedtexts set ' . 'AtLgID = ' . $_REQUEST["AtLgID"] . ', ' . 'AtTitle = ' . convert_string_to_sqlsyntax($_REQUEST["AtTitle"]) . ', ' . 'AtText = ' . convert_string_to_sqlsyntax($_REQUEST["AtText"]) . ', ' . 'AtAudioURI = ' . convert_string_to_sqlsyntax($_REQUEST["AtAudioURI"]) . ' ' . 'where AtID = ' . $_REQUEST["AtID"], "Updated");
        $id = $_REQUEST["AtID"];
    }
    saveArchivedTextTags($id);
}
// CHG
开发者ID:hans,项目名称:lwt,代码行数:31,代码来源:edit_archivedtexts.php


示例3: splitCheckText


//.........这里部分代码省略.........
            $trans = get_first_value("select WoTranslation as value from " . $tbpref . "words where WoLgID = " . $lid . " and WoTextLC = " . convert_string_to_sqlsyntax($key));
            if (!isset($trans)) {
                $trans = "";
            }
            if ($trans == "*") {
                $trans = "";
            }
            if ($trans != "") {
                $r .= "<li " . ($rtlScript ? 'dir="rtl"' : '') . "><span class=\"red2\">[" . tohtml($key) . "] — " . $value[0] . " - " . tohtml(repl_tab_nl($trans)) . "</span></li>";
            } else {
                $r .= "<li " . ($rtlScript ? 'dir="rtl"' : '') . ">[" . tohtml($key) . "] — " . $value[0] . "</li>";
            }
            $anz++;
        }
        $r .= "</ul><p>TOTAL: " . $anz . "</p><h4>Non-Word List</h4><ul>";
        if (array_key_exists('', $wordSeps)) {
            unset($wordSeps['']);
        }
        ksort($wordSeps);
        $anz = 0;
        foreach ($wordSeps as $key => $value) {
            $r .= "<li>[" . str_replace(" ", "<span class=\"backgray\">&nbsp;</span>", tohtml($key)) . "] — " . $value . "</li>";
            $anz++;
        }
        $r .= "</ul><p>TOTAL: " . $anz . "</p></div>";
        return $r;
    }
    ////////////////////////////////////
    // Split: insert sentences/textitems entries in DB
    $sentNumber = 0;
    $lfdnr = 0;
    foreach ($textLines as $value) {
        $dummy = runsql('INSERT INTO ' . $tbpref . 'sentences (SeLgID, SeTxID, SeOrder, SeText) VALUES (' . $lid . ',' . $id . ',' . ($sentNumber + 1) . ',' . convert_string_to_sqlsyntax_notrim_nonull(remove_spaces($value . ' ', $removeSpaces)) . ')', ' ');
        $sentid = get_last_key();
        $lineWords[$sentNumber] = preg_split('/([^' . $termchar . ']+)/u', $value . ' ', null, PREG_SPLIT_DELIM_CAPTURE);
        $l = count($lineWords[$sentNumber]);
        $sqltext = 'INSERT INTO ' . $tbpref . 'textitems (TiLgID, TiTxID, TiSeID, TiOrder, TiWordCount, TiText, TiTextLC, TiIsNotWord) VALUES ';
        $lfdnr1 = 0;
        for ($i = 0; $i < $l; $i++) {
            $term = mb_strtolower($lineWords[$sentNumber][$i], 'UTF-8');
            $rest2 = '';
            $rest3 = '';
            $rest4 = '';
            $rest5 = '';
            $rest6 = '';
            $rest7 = '';
            $rest8 = '';
            $rest9 = '';
            $restlc2 = '';
            $restlc3 = '';
            $restlc4 = '';
            $restlc5 = '';
            $restlc6 = '';
            $restlc7 = '';
            $restlc8 = '';
            $restlc9 = '';
            if ($term != '') {
                if ($i % 2 == 0) {
                    $isnotwort = 0;
                    $rest = $lineWords[$sentNumber][$i];
                    $cnt = 0;
                    for ($j = $i + 1; $j < $l; $j++) {
                        if ($lineWords[$sentNumber][$j] != '') {
                            $rest .= $lineWords[$sentNumber][$j];
                            $cnt++;
                            if ($cnt == 2) {
开发者ID:shoehn,项目名称:learningwithtext,代码行数:67,代码来源:utilities.inc.php


示例4: get_page_link

                                |
                                <a href="<?php 
        echo get_page_link('edit_user');
        ?>
&user_id=<?php 
        echo $item->ID;
        ?>
">Редактировать</a>
                                |
                                <a class="button-control table-delete" data-set-action="delete_user">Удалить</a>
                            </p>
                        </td>
                        <td>
                            <?php 
        if (is_array($item->groups_ID)) {
            $last = get_last_key($item->groups_ID);
            foreach ($item->groups_ID as $key => $group) {
                $key_search = array_multi_search($group, $groups, 'ID');
                if ($key_search !== null) {
                    echo $groups[$key_search]->name;
                    if ($key != $last) {
                        echo ', ';
                    }
                }
            }
        }
        ?>
                        </td>
                    </tr> 
                <?php 
    }
开发者ID:taqtaq11,项目名称:detemiro,代码行数:31,代码来源:list.php


示例5: header

<?php

header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header('Content-type: application/json');
function get_last_key(&$array)
{
    end($array);
    return key($array);
}
$size = sizeof($results);
echo '[';
for ($i = 0; $i < $size; $i++) {
    $item = $results[$i];
    echo '{';
    $last_field = get_last_key($item);
    foreach ($item as $field_name => $value) {
        echo '"$' . $field_name . '":' . json_encode($value);
        if ($field_name != $last_field) {
            echo ',';
        }
    }
    echo '}';
    if ($i < $size - 1) {
        echo ',';
    }
}
echo ']';
开发者ID:hemant-chouhan,项目名称:Ganga_Weld,代码行数:30,代码来源:JSON_collection.php


示例6: splitText

function splitText($text, $lid, $id)
{
    $sql = "select * from languages where LgID=" . $lid;
    $res = mysql_query($sql);
    if ($res == FALSE) {
        die("Invalid Query: {$sql}");
    }
    $record = mysql_fetch_assoc($res);
    if ($record == FALSE) {
        die("No results: {$sql}");
    }
    $removeSpaces = $record['LgRemoveSpaces'];
    $splitEachChar = $record['LgSplitEachChar'];
    $splitSentence = $record['LgRegexpSplitSentences'];
    $noSentenceEnd = $record['LgExceptionsSplitSentences'];
    $termchar = $record['LgRegexpWordCharacters'];
    $replace = explode("|", $record['LgCharacterSubstitutions']);
    mysql_free_result($res);
    $s = str_replace("\r\n", "\n", $text);
    $s = str_replace("\n", " ¶ ", $s);
    $s = str_replace("\t", " ", $s);
    $s = trim($s);
    if ($splitEachChar) {
        $s = preg_replace('/([^\\s])/u', "\$1 ", $s);
    }
    $s = preg_replace('/\\s{2,}/u', ' ', $s);
    $s = str_replace('{', '[', $s);
    // because of sent. spc. char
    $s = str_replace('}', ']', $s);
    foreach ($replace as $value) {
        $fromto = explode("=", trim($value));
        if (count($fromto) >= 2) {
            $s = str_replace(trim($fromto[0]), trim($fromto[1]), $s);
        }
    }
    $s = trim($s);
    if ($noSentenceEnd != '') {
        $s = preg_replace('/(' . $noSentenceEnd . ')\\s/u', '$1‧', $s);
    }
    $s = preg_replace('/([' . $splitSentence . '¶])\\s/u', "\$1\n", $s);
    $s = str_replace(" ¶\n", "\n¶\n", $s);
    $s = str_replace('‧', ' ', $s);
    if ($s == '') {
        $textLines = array($s);
    } else {
        $s = explode("\n", $s);
        $l = count($s);
        for ($i = 0; $i < $l; $i++) {
            $s[$i] = trim($s[$i]);
            if ($s[$i] != '') {
                $pos = strpos($splitSentence, $s[$i]);
                while ($pos !== false && $i > 0) {
                    $s[$i - 1] .= " " . $s[$i];
                    for ($j = $i + 1; $j < $l; $j++) {
                        $s[$j - 1] = $s[$j];
                    }
                    array_pop($s);
                    $l = count($s);
                    $pos = strpos($splitSentence, $s[$i]);
                }
            }
        }
        $l = count($s);
        $textLines = array();
        for ($i = 0; $i < $l; $i++) {
            $zz = trim($s[$i]);
            if ($zz != '') {
                $textLines[] = $zz;
            }
        }
    }
    $lineWords = array();
    $wordList = array();
    $wordIndex = array();
    $wordSeps = array();
    $sentNumber = 0;
    $lfdnr = 0;
    foreach ($textLines as $value) {
        $dummy = runsql('INSERT INTO sentences (SeLgID, SeTxID, SeOrder, SeText) VALUES (' . $lid . ',' . $id . ',' . ($sentNumber + 1) . ',' . convert_string_to_sqlsyntax_notrim_nonull(remove_spaces($value . ' ', $removeSpaces)) . ')', ' ');
        $sentid = get_last_key();
        /**** Speichern Sätze Ende ***/
        $lineWords[$sentNumber] = preg_split('/([^' . $termchar . ']+)/u', $value . ' ', null, PREG_SPLIT_DELIM_CAPTURE);
        $l = count($lineWords[$sentNumber]);
        $sqltext = 'INSERT INTO textitems (TiLgID, TiTxID, TiSeID, TiOrder, TiWordCount, TiText, TiTextLC, TiIsNotWord) VALUES ';
        $lfdnr1 = 0;
        for ($i = 0; $i < $l; $i++) {
            $term = mb_strtolower($lineWords[$sentNumber][$i], 'UTF-8');
            $rest2 = '';
            $rest3 = '';
            $rest4 = '';
            $rest5 = '';
            $rest6 = '';
            $rest7 = '';
            $rest8 = '';
            $rest9 = '';
            $restlc2 = '';
            $restlc3 = '';
            $restlc4 = '';
            $restlc5 = '';
            $restlc6 = '';
//.........这里部分代码省略.........
开发者ID:russell359,项目名称:lwt,代码行数:101,代码来源:utilities.inc.php


示例7: string_values

function string_values($arr, $var = null, $par = null)
{
    $str = '';
    $mode = is_assoc_array($arr) && $par == null ? true : false;
    if ($mode) {
        $par = $var;
    }
    $custom = array('separ' => ',', 'empty' => 'NULL', 'middle' => '=', 'body' => "'", 'json' => false);
    $custom = set_merge($custom, $par);
    $arr = take_good_array($arr, true, $custom['json']);
    if (!$mode) {
        $var = take_good_array($var, false, $custom['json']);
        if (count($arr) == 1 && count($var) > 1) {
            $var = array(json_val_encode($var));
        }
    }
    $L = get_last_key($arr);
    $i = 1;
    if (!$mode && $var) {
        $B = count($arr) < count($var) ? count($arr) : count($var);
    } else {
        $B = count($arr);
    }
    foreach ($arr as $key => $item) {
        if ($i <= $B) {
            $item1 = $item2 = null;
            if ($mode) {
                $item1 = $key;
                $item2 = $item;
            } elseif (isset($var[$key])) {
                $item1 = $item;
                $item2 = $var[$key];
            }
            if (is_jsoned($item1)) {
                $item1 = json_val_encode($item1);
            }
            if (is_jsoned($item2)) {
                $item2 = json_val_encode($item2);
            }
            $str .= "{$item1}{$custom['middle']}{$custom['body']}{$item2}{$custom['body']}";
            if ($key != $L && $i < $B) {
                $str .= $custom['separ'];
            }
            $i++;
        }
    }
    return $str;
}
开发者ID:taqtaq11,项目名称:detemiro,代码行数:48,代码来源:basic-functions.php


示例8: get_last_key

    echo $user->last_ip;
    ?>
</td>
            </tr>
            <tr>
                <td>Последнее место</td>
                <td><?php 
    echo $user->last_place;
    ?>
</td>
            </tr>
            <tr>
                <td>Группы</td>
                <td><?php 
    if (is_array($user->groups_ID)) {
        $last = get_last_key($user->groups_ID);
        foreach ($user->groups_ID as $key => $group) {
            $key_search = array_multi_search($group, $groups, 'ID');
            if ($key_search !== null) {
                echo $groups[$key_search]->name;
                if ($key != $last) {
                    echo ', ';
                }
            }
        }
    }
    ?>
</td>
            </tr>
            <tr>
                <td>Права</td>
开发者ID:taqtaq11,项目名称:detemiro,代码行数:31,代码来源:info.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_last_retrieve_url_contents_content_type函数代码示例发布时间:2022-05-15
下一篇:
PHP get_languages函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap