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


PHP shift函数代码示例

本文整理汇总了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;
 }
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:31,代码来源:sudoku.class.php

示例2: decode

function decode($encryptedText, $key)
{
    $newString = "";
    for ($i = 0; $i < strlen($encryptedText); $i++) {
        $newString .= shift($encryptedText[$i], -$key);
    }
    return $newString;
}
开发者ID:WilliamRADFunk,项目名称:encryptor,代码行数:8,代码来源:caesar.php

示例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);
}
开发者ID:floganz,项目名称:Trainee-Task,代码行数:9,代码来源:encrypt.php

示例4: getUser

 function getUser()
 {
     if(!isset($_SESSION['user_id']))
         return false;
     
     $where = "user_id = '".$_SESSION['user_id']."' ";
     $user = shift(select('*', 'users', $where));
     
     return $user;
 }
开发者ID:nicolaes,项目名称:WatchMyStuff,代码行数:10,代码来源:functions.php

示例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);
}
开发者ID:floganz,项目名称:Trainee-Task,代码行数:11,代码来源:guess.php

示例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;
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:11,代码来源:old.php

示例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;
    }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:24,代码来源:ReviewerSubmissionDAO.inc.php

示例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");
开发者ID:rommelxcastro,项目名称:CRI-Online-Sales---Admin,代码行数:31,代码来源:authRefund.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;
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:7,代码来源:xmlrpc.php

示例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));
 }
开发者ID:pulipulichen,项目名称:ocs,代码行数:20,代码来源:RoleDAO.inc.php

示例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;
 }
开发者ID:hoangsoft90,项目名称:hw-sudoku-wordpress,代码行数:25,代码来源:hphp.php

示例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);
开发者ID:prozorovAlexey,项目名称:Caesar,代码行数:31,代码来源:answer.php

示例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);
开发者ID:hvze,项目名称:tornado-text,代码行数:31,代码来源:tornado.php


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