本文整理汇总了PHP中shift函数的典型用法代码示例。如果您正苦于以下问题:PHP shift函数的具体用法?PHP shift怎么用?PHP shift使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shift函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: group_top_right_items
/**
* Các phần tử ở phía góc top-right so với phần tử ($i,$j)
* @param $i
* @param $j
*/
public function group_top_right_items($i, $j)
{
if ($i >= 1) {
$ds = array('max', true);
$res = array();
for ($q = 0; $q < $i + 1; $q++) {
$ds_ = $this->get_row_items($q);
shift($ds_, $j + 1);
if (count($ds_)) {
$ds[] = $ds_;
}
}
//if($i==1&&$j==2) out1($ds);
if (count($ds) > 2) {
$res = cross_array($ds);
if (!count($res)) {
$ds[0] = 'min';
$res = cross_array($ds);
}
return $res;
} else {
return false;
}
}
return false;
}
示例2: decode
function decode($encryptedText, $key)
{
$newString = "";
for ($i = 0; $i < strlen($encryptedText); $i++) {
$newString .= shift($encryptedText[$i], -$key);
}
return $newString;
}
示例3: encrypt_message
function encrypt_message($str, $sh)
{
$length = strlen($str);
for ($i = 0; $i < $length; $i++) {
$res[$i] = shift($str[$i], $sh);
}
$tmp['result'] = implode($res);
echo json_encode($tmp);
}
示例4: getUser
function getUser()
{
if(!isset($_SESSION['user_id']))
return false;
$where = "user_id = '".$_SESSION['user_id']."' ";
$user = shift(select('*', 'users', $where));
return $user;
}
示例5: encrypt_message
function encrypt_message($str)
{
$sh = getFrequencyShift($str);
$length = strlen($str);
for ($i = 0; $i < $length; $i++) {
$res[$i] = shift($str[$i], $sh);
}
$tmp['result'] = implode($res);
$tmp['shift'] = $sh;
echo json_encode($tmp);
}
示例6: array_map
function array_map()
{
$arrays = get_func_args();
$callback = shift($arrays);
$r =& $arrays[0];
foreach ($r as $key => $val) {
$val = call_user_func_array($callback, $arrays);
$r[$key] = $val;
}
return $r;
}
示例7: getDirectorDecisions
/**
* Get the director decisions for a review round of a paper.
* @param $paperId int
* @param $round int
*/
function getDirectorDecisions($paperId, $round = null)
{
$decisions = array();
$args = array($paperId);
if ($round) {
$args[] = $round;
}
$result =& $this->retrieve('
SELECT edit_decision_id, director_id, decision, date_decided
FROM edit_decisions
WHERE paper_id = ?' . ($round ? ' AND round = ?' : '') . ' ORDER BY edit_decision_id ASC', count($args) == 1 ? shift($args) : $args);
while (!$result->EOF) {
$decisions[] = array('editDecisionId' => $result->fields['edit_decision_id'], 'directorId' => $result->fields['director_id'], 'decision' => $result->fields['decision'], 'dateDecided' => $this->datetimeFromDB($result->fields['date_decided']));
$result->moveNext();
}
$result->Close();
unset($result);
return $decisions;
}
示例8:
?>
</td>
<!-- segunda columna, noticias xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
<td width="927" valign="top" style="padding-left:10px; padding-right:10px;">
<?php
switch($transaccion){
default:
$idusuario=$sql->uncampo("SELECT id_usuario FROM usuario WHERE login='".$usuario."'");
$tpl->leer_plantilla("html/auth_refund.html");
$tpl->reemplazar("{shift}",$sh);
$tpl->reemplazar("{idshift}",shift());
$tpl->reemplazar("{date}",$f->fechadehoy());
$tpl->reemplazar("{idagent}",$idusuario);
$tpl->reemplazar("{agent}",$sql->uncampo("SELECT nombre FROM usuario WHERE id_usuario='".$idusuario."'"));
$tpl->reemplazar("{url}","authRefund.php?tipo=$tipo&usuario=$usuario&transaccion=save");
$tpl->mostrarplantilla();
break;
case "save":
if($sql->consulta("INSERT INTO auth_refunds(id,id_agent,fecha,shift,member_id,fullname,email,amount,status,comment)
values(Null,'".$_POST["idagent"]."','".$_POST["date"]."','".$_POST["shift"]."','".$_POST["memberid"]."',
'".$_POST["fullname"]."','".$_POST["email"]."','".$_POST["amount"]."','0','".$_POST["comment"]."')")){
echo "Datos grabados<br><br>";
include("correo.php");
示例9: call
function call($method)
{
$params = func_get_args();
shift($params);
$r = xmlrpc_request($this->serverm, $method, $params, $this->plus, $this->gzip);
return $r;
}
示例10: deleteRoleByUserId
/**
* Delete all roles for a specified conference.
* @param $userId int
* @param $conferenceId int optional, include roles only in this conference
* @param $roleId int optional, include only this role
*/
function deleteRoleByUserId($userId, $conferenceId = null, $roleId = null, $schedConfId = null)
{
$args = array((int) $userId);
if (isset($conferenceId)) {
$args[] = (int) $conferenceId;
}
if (isset($roleId)) {
$args[] = (int) $roleId;
}
if (isset($schedConfId)) {
$args[] = (int) $schedConfId;
}
return $this->update('DELETE FROM roles WHERE user_id = ?' . (isset($conferenceId) ? ' AND conference_id = ?' : '') . (isset($roleId) ? ' AND role_id = ?' : '') . (isset($schedConfId) ? ' AND sched_conf_id = ?' : ''), count($args) ? $args : shift($args));
}
示例11: trim
function trim($t = '')
{
$a = optimize_args(func_get_args());
if (isNum($a[0])) {
$b = shift($a);
} else {
$b = 0;
}
trim($this->O);
for ($i = 0; $i < count($a); $i++) {
foreach ($a as $v) {
if (isStr($v)) {
if ($v == 'number') {
$c = '\\d';
} else {
$c = $v;
}
$lef = '^(\\/?(\\s+|)(' . $c . '+))';
$rig = '(' . $c . '+)?(\\s+|)$';
$this->O = preg_replace('/' . (!isDrw($b) ? $lef . '|' . $rig : ($b[1] < 0 ? $lef : $rig)) . '/', '', $this->O);
}
}
}
return $this;
}
示例12: fopen
break;
} else {
$result = $result . $alph[($j + $key) % $N];
break;
}
}
if ($text[$i] == $alph2[$j]) {
if (($j + $key) % $N < 0) {
$result = $result . $alph2[$N + ($j + $key) % $N];
break;
} else {
$result = $result . $alph2[($j + $key) % $N];
break;
}
}
if ($text[$i] != $alph2[$j] && $text[$i] != $alph[$j] && $j == $N - 1) {
//перенос всех остальных букв и символов без изменений
$result = $result . $text[$i];
}
}
}
$fp = fopen('data.txt', 'a+');
//открытие и запись в файл
fwrite($fp, "Step: " . $key . "\r\n");
fwrite($fp, "Input: " . $text . "\r\n");
fwrite($fp, "Ouput: " . $result . "\r\n\r\n");
fclose($fp);
return $result;
}
$result = shift($_REQUEST['input'], $_REQUEST['step']);
echo json_encode($result);
示例13: while
$text = false;
while ($text === false) {
echo 'Enter some text:', "\n";
$text = trim(fgets(STDIN));
if ($text === "") {
$text = false;
}
}
$default = mb_strlen($text) + 1;
$count = false;
while ($count === false) {
echo 'Enter line amount (-1 for ∞, default: ', $default, '):', "\n";
$count = intval(trim(fgets(STDIN)));
if ($count === 0) {
$count = $default;
}
if ($count === -1) {
$count = PHP_INT_MAX;
}
if ($count < -1) {
$count = false;
}
}
for ($i = 0; $i < $count; $i++) {
echo $text, "\n";
$text = shift($text);
if ($i === PHP_INT_MAX) {
$i = 0;
}
}
exit(0);