本文整理汇总了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;
}
示例2: build
public function build(&$params = null)
{
$params = array();
$query[] = 'delete from';
$query[] = $this->table;
$query[] = $this->fetchWhere($params);
return concat($query);
}
示例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;
}
示例4: getClass
public function getClass(GymEx $ex)
{
$data = array();
/* @var $gr GymGr */
foreach ($ex->getGroups() as $gr) {
$data[] = 'g' . $gr->getId();
}
return concat($data);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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> <br /> <br /> <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'), '&', '&')) . '\');});
</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');
}
示例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}") : '';
}
示例11: testConcat
public function testConcat()
{
$this->assertEquals("ab", concat("a", "b"));
$this->assertEquals("a-b", concat("a", "-", "b"));
}
示例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;
}
示例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;
}
示例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;
}, []);
}
示例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);
}