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


PHP concat函数代码示例

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


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

示例1: registerSolution

 /**
  * Регистрирует решение задачи
  * 
  * @return bool - признак, был ли ответ привязан к авторизованному пользователю
  */
 public function registerSolution($taskIdent, $matchesStr)
 {
     $task = $this->taskByIdent($taskIdent);
     $matchesStr = normalize_string($matchesStr, true);
     $mCnt = $task['m'];
     $sCnt = $task['s'];
     $cols = $task['c'];
     $rows = $task['r'];
     $excluded = $this->strToArray($matchesStr, $mCnt, $cols, $rows);
     ksort($excluded);
     //Вычисляем оставшиеся спички (пробегаем по всем точкам и берём правую и верхнюю спичку)
     $matches = array();
     for ($x = 0; $x <= $cols; $x++) {
         for ($y = 0; $y <= $rows; $y++) {
             $matchId = $this->matchId($x, $y, $x + 1, $y);
             if (!array_key_exists($matchId, $excluded) && $x + 1 <= $cols) {
                 $matches[$matchId] = true;
             }
             $matchId = $this->matchId($x, $y, $x, $y + 1);
             if (!array_key_exists($matchId, $excluded) && $y + 1 <= $rows) {
                 $matches[$matchId] = true;
             }
         }
     }
     $sqCnt = 0;
     //Скопируем массив
     $badMatches = $matches;
     //Вычисляем координаты всех квадратов
     for ($x = 0; $x < $cols; $x++) {
         for ($y = 0; $y < $rows; $y++) {
             //Проверяем точку
             $endX = $x;
             $endY = $y;
             while (++$endX <= $cols && ++$endY <= $rows) {
                 $bounds = $this->isFullSquare($x, $y, $endX, $endY, $matches);
                 if ($bounds) {
                     ++$sqCnt;
                     foreach ($bounds as $key => $val) {
                         unset($badMatches[$key]);
                     }
                 }
             }
         }
     }
     $badMatches = empty($badMatches) ? false : concat(array_keys($badMatches));
     check_condition(!$badMatches, "Bad matches left: [{$badMatches}]");
     check_condition($sqCnt == $sCnt, "Invalid squares cnt: [{$sqCnt}], required: [{$sCnt}].");
     //Сохраняем в базу
     $userId = AuthManager::getUserIdOrNull();
     //Склеим строку из отсартированных спичек
     $matchesStr = $this->arrToStr($excluded);
     //Регистрируем ответ пользователя
     $ansBindedToUser = MatchesBean::inst()->registerAnswer($taskIdent, $matchesStr, $userId);
     //Если зарегистрировали, попробуем дать очки
     if ($ansBindedToUser && $userId) {
         PL_matches::inst()->givePoints(PsUser::inst());
     }
     //Возвратим признак выданных очков
     return $ansBindedToUser;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:65,代码来源:MatchesManager.php

示例2: build

 public function build(&$params = null)
 {
     $params = array();
     $query[] = 'delete from';
     $query[] = $this->table;
     $query[] = $this->fetchWhere($params);
     return concat($query);
 }
开发者ID:ilivanoff,项目名称:www,代码行数:8,代码来源:PSDelete.php

示例3: doTree

/**
 * Generate XML for the browser tree.
 */
function doTree()
{
    global $misc, $data;
    $casts = $data->getCasts();
    $proto = concat(field('castsource'), ' AS ', field('casttarget'));
    $attrs = array('text' => $proto, 'icon' => 'Cast');
    $misc->printTree($casts, $attrs, 'casts');
    exit;
}
开发者ID:phjeannine,项目名称:hakoopix,代码行数:12,代码来源:casts.php

示例4: getClass

 public function getClass(GymEx $ex)
 {
     $data = array();
     /* @var $gr GymGr */
     foreach ($ex->getGroups() as $gr) {
         $data[] = 'g' . $gr->getId();
     }
     return concat($data);
 }
开发者ID:ilivanoff,项目名称:www,代码行数:9,代码来源:GymManager.php

示例5: build

 public function build(&$params = null)
 {
     $params = array();
     $query[] = 'insert into';
     $query[] = $this->table;
     $query[] = $this->fetchWhatInsCols();
     $query[] = 'values';
     $query[] = $this->fetchWhatInsVals($params);
     return concat($query);
 }
开发者ID:ilivanoff,项目名称:www,代码行数:10,代码来源:PSInsert.php

示例6: doTree

/**
 * Generate XML for the browser tree.
 */
function doTree()
{
    global $misc, $data;
    $opclasses = $data->getOpClasses();
    // OpClass prototype: "op_class/access_method"
    $proto = concat(field('opcname'), '/', field('amname'));
    $attrs = array('text' => $proto, 'icon' => 'OperatorClass', 'toolTip' => field('opccomment'));
    $misc->printTree($opclasses, $attrs, 'opclasses');
    exit;
}
开发者ID:yxwzaxns,项目名称:DaoCloud_phpPgAdmin,代码行数:13,代码来源:opclasses.php

示例7: build

 public function build(&$params = null)
 {
     $params = array();
     $query[] = 'update';
     $query[] = $this->table;
     $query[] = 'set';
     $query[] = $this->fetchWhat($params);
     $query[] = $this->fetchWhere($params);
     return concat($query);
 }
开发者ID:ilivanoff,项目名称:www,代码行数:10,代码来源:PSUpdate.php

示例8: build

 public function build(&$params = null)
 {
     $params = array();
     $query[] = 'select';
     $query[] = $this->what;
     $query[] = 'from';
     $query[] = $this->table;
     $query[] = $this->fetchWhere($params);
     $query[] = self::concatQueryTokens('group by', $this->group);
     $query[] = self::concatQueryTokens('order by', $this->order);
     $query[] = self::concatQueryTokens('limit', $this->limit);
     return concat($query);
 }
开发者ID:ilivanoff,项目名称:www,代码行数:13,代码来源:PSSelect.php

示例9: html_65c161fa3974dab7ff9b5b08fa07491e

function html_65c161fa3974dab7ff9b5b08fa07491e($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0)
{
    if (isset($Pile[0]["doublons"]) and is_array($Pile[0]["doublons"])) {
        $doublons = nettoyer_env_doublons($Pile[0]["doublons"]);
    }
    $connect = '';
    $page = ($t1 = strval(invalideur_session($Cache, (function_exists("autoriser") || include_spip("inc/autoriser")) && autoriser('configurer', '_admin_vider') ? " " : "" ? ' ' : ''))) !== '' ? $t1 . ('

' . boite_ouvrir(interdire_scripts(wrap(concat(filtre_balise_img_dist(chemin_image('image-24.png'), '', 'cadre-icone'), _T('info_images_auto')), '<h3>')), 'simple', 'titrem') . '<div id="placehoder_taille_cache_images"><p>&nbsp;<br />&nbsp;<br />&nbsp;<br /></p></div>
	<script type="text/javascript">
		jQuery(function(){jQuery(\'#placehoder_taille_cache_images\').animateLoading().load(\'' . invalideur_session($Cache, replace(generer_action_auteur('calculer_taille_cache', 'images'), '&amp;', '&')) . '\');});
	</script>
	<noscript>
		<iframe src="' . invalideur_session($Cache, generer_action_auteur('calculer_taille_cache', 'images')) . '" style="width: 100%;height: 3em;overflow: hidden;"></iframe>
	</noscript>

' . boite_pied() . '
	' . bouton_action(_T('public|spip|ecrire:bouton_vider_cache'), invalideur_session($Cache, generer_action_auteur('purger', 'vignettes', invalideur_session($Cache, self()))), 'ajax') . '
' . boite_fermer() . '
') : '';
    return analyse_resultat_skel('html_65c161fa3974dab7ff9b5b08fa07491e', $Cache, $page, '../prive/squelettes/inclure/admin_vider_images.html');
}
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:22,代码来源:html_65c161fa3974dab7ff9b5b08fa07491e.php

示例10: concatQueryTokens

 /**
  * Метод объединяет элементы массива в строку для запроса
  */
 protected static function concatQueryTokens($prefix, $tokens, $glue = ', ', $takeTotallyEmpty = false)
 {
     $paramsStr = trim(is_array($tokens) ? concat($tokens, $glue, $takeTotallyEmpty) : $tokens);
     return $paramsStr ? trim("{$prefix} {$paramsStr}") : '';
 }
开发者ID:ilivanoff,项目名称:www,代码行数:8,代码来源:Query.php

示例11: testConcat

 public function testConcat()
 {
     $this->assertEquals("ab", concat("a", "b"));
     $this->assertEquals("a-b", concat("a", "-", "b"));
 }
开发者ID:PaulAntunes,项目名称:gclf-paul,代码行数:5,代码来源:GlobalFunctionsTest.php

示例12: file_get_contents

<?php

// prerequesites as determined by query (and perhaps device-sniffing), like polyfills and l10n data
$prereqs = '';
if (false) {
    $prereqs = '<script>' . file_get_contents('../../components/webcomponents-lite.min.js') . '</script>';
}
// critical segment: always necessary
$critical = concat(["src/index.css.html", "src/nav-bar.html", "src/some-content.html", "src/simple-router.html", "src/service-worker.html", "src/google-analytics.html"]);
// contextual segment: other modules identified from query
$contextual = concat([]);
// lazy segment: optional modules
$lazy = concat([]);
// collect dynamic payload
$payload = "{$prereqs} {$critical} {$contextual} {$lazy}";
// main index
$index = file_get_contents('index.main.html');
// replace client-side load instruction with constructed payload
$index = str_replace('<link rel="import" href="src/imports.html">', $payload, $index);
// serve
echo $index;
// concatenate module-content into a string
function concat($modules)
{
    $result = "";
    foreach ($modules as $module) {
        $result .= file_get_contents($module);
    }
    return $result;
}
开发者ID:frankiefu,项目名称:nano-lab,代码行数:30,代码来源:index.main.php

示例13: doTree

/**
 * Generate XML for the browser tree.
 */
function doTree()
{
    global $misc, $data;
    $aggregates = $data->getAggregates();
    $proto = concat(field('proname'), ' (', field('proargtypes'), ')');
    $reqvars = $misc->getRequestVars('aggregate');
    $attrs = array('text' => $proto, 'icon' => 'Aggregate', 'toolTip' => field('aggcomment'), 'action' => url('redirect.php', $reqvars, array('action' => 'properties', 'aggrname' => field('proname'), 'aggrtype' => field('proargtypes'))));
    $misc->printTree($aggregates, $attrs, 'aggregates');
    exit;
}
开发者ID:yxwzaxns,项目名称:DaoCloud_phpPgAdmin,代码行数:13,代码来源:aggregates.php

示例14: pluck

/**
 * Plucks a property from a collection of associative arrays.
 *
 * eg:
 * 	Fn\pluck([
 * 			['name' => 'moe', 'age' => 45],
 * 			['name' => 'larry', 'age' => 55],
 * 			['name' => 'curly', 'age' => 65]
 * 		], 'name')
 * // ['moe', 'larry', 'curly']
 *
 * @param array[] $collection
 * @param string $propName
 * @return mixed
 */
function pluck(array $collection, $propName)
{
    return array_reduce($collection, function ($vals, $item) use($propName) {
        return isset($item[$propName]) ? concat($vals, $item[$propName]) : $vals;
    }, []);
}
开发者ID:aerisweather,项目名称:Fn,代码行数:21,代码来源:Fn.php

示例15: next_level_dir

function next_level_dir($dirs1, $dirs2 = null, $dirs3 = null, $dirs4 = null)
{
    return normalize_path(concat(func_get_args(), DIR_SEPARATOR), DIR_SEPARATOR);
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:4,代码来源:Defines.php


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