本文整理汇总了PHP中Count函数的典型用法代码示例。如果您正苦于以下问题:PHP Count函数的具体用法?PHP Count怎么用?PHP Count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Count函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submit
function submit()
{
$this->load->library('form_validation');
$leave_start = $this->input->post('leave_start');
$leave_end = $this->input->post('leave_end');
$this->form_validation->set_rules('leave_start', 'Date From', 'required|callback_checkdates');
$this->form_validation->set_rules('leave_end', 'Date to', 'required');
$this->form_validation->set_error_delimiters('<span class="help-block" style="color:red">', '</span>');
if ($this->form_validation->run() == FALSE) {
$this->index();
} else {
$date1 = date('Y-m-d', strtotime(str_replace('/', '-', $leave_start)));
$date2 = date('Y-m-d', strtotime(str_replace('/', '-', $leave_end)));
$this->session->set_userdata('date1', $leave_start);
$this->session->set_userdata('date2', $leave_end);
$data['title'] = $this->m_setting->getSetting();
//$data['headform'] = $this->m_outsource->viewHeadForm($formid);
$removetmp = $this->m_outsource->removeOTMP($date1, $date2);
for ($i = 0; $i < Count($removetmp); $i++) {
$dataattd = array('othour' => '0');
$this->db->where('userid', $removetmp[$i]['userid']);
$this->db->where('date', $removetmp[$i]['date']);
$this->db->update('attendance', $dataattd);
}
$this->session->set_userdata('noticebox', '5');
$this->index();
}
}
示例2: Styles_HostsIDs
function Styles_HostsIDs($Element)
{
/****************************************************************************/
$__args_types = array('string');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$Result = array();
#-----------------------------------------------------------------------------
$HostsIDs = $GLOBALS['HOST_CONF']['HostsIDs'];
#-----------------------------------------------------------------------------
if (isset($_COOKIE['StyleID'])) {
Array_UnShift($HostsIDs, $_COOKIE['StyleID']);
}
#-----------------------------------------------------------------------------
foreach ($HostsIDs as $HostID) {
#---------------------------------------------------------------------------
$Path = SPrintF('%s/styles/%s/%s', SYSTEM_PATH, $HostID, $Element);
#---------------------------------------------------------------------------
if (File_Exists($Path)) {
$Result[] = $HostID;
}
}
#-----------------------------------------------------------------------------
if (Count($Result) < 1) {
return ERROR | @Trigger_Error(SPrintF('[Styles_HostsIDs]: не удалось найти хосты для элемента (%s)', $Element));
}
#-----------------------------------------------------------------------------
return $Result;
}
示例3: get_MaxValueByControlId
function get_MaxValueByControlId($ControlId) {
$VariableObject = IPS_GetVariable($ControlId);
$ProfileName = $VariableObject['VariableCustomProfile'];
$ProfileObject = IPS_GetVariableProfile($ProfileName);
$MaxValue = Count($ProfileObject['Associations']);
return $MaxValue;
}
示例4: loadIntoData
public function loadIntoData($results, $location, $lat, $long)
{
foreach ($results->entry as $result) {
$google = $result->children('http://base.google.com/ns/1.0');
//get location
$twitter_location = $google->location;
//get username
$username = $result->author->name;
//get date
$created_date = $result->published;
$time = strtotime($created_date);
$myDate = date('y-m-d H:i:s', $time);
//precompile hashtags for quick querying
$array = explode(' ', $result->title);
$array_size = Count($array);
$i = 0;
$perLineHashTag = '';
while ($i < $array_size) {
if (startsWithX($array[$i], "#")) {
$perLineHashTag = $perLineHashTag . $array[$i] . " ";
} else {
//not a hashtag
}
$i = $i + 1;
}
//enter data into table
$query = "INSERT INTO `data` VALUES ('{$result->title}','{$username}','{$location}','{$long}','{$lat}','{$myDate}','{$twitter_location}','{$perLineHashTag}')";
mysql_query($query);
//delete entries over one week old
$query2 = "DELETE FROM `data` WHERE `date` < DATE_SUB(NOW(), INTERVAL 1 WEEK)";
mysql_query($query2);
}
}
示例5: XML_Read
function XML_Read($Object, $Level = 1)
{
#-----------------------------------------------------------------------------
static $Index = 1;
#-----------------------------------------------------------------------------
$Md5 = Md5($Index++);
#-----------------------------------------------------------------------------
$Attribs = $Object->Attribs;
#-----------------------------------------------------------------------------
$Name = isset($Attribs['comment']) ? $Attribs['comment'] : $Object->Name;
#-----------------------------------------------------------------------------
$P = new Tag('P', array('class' => 'NodeName', 'onclick' => SPrintF("TreeSwitch('%s');", $Md5)), new Tag('IMG', array('align' => 'left', 'src' => 'SRC:{Images/Icons/Node.gif}')), new Tag('SPAN', $Name));
#-----------------------------------------------------------------------------
$Node = new Tag('DIV', array('class' => 'Node'), $P);
#-----------------------------------------------------------------------------
if (Count($Attribs)) {
#---------------------------------------------------------------------------
foreach (Array_Keys($Attribs) as $AttribID) {
$Node->AddChild(new Tag('P', array('class' => 'NodeParam'), new Tag('SPAN', SPrintF('%s: ', $AttribID)), new Tag('SPAN', array('class' => 'NodeParam'), $Attribs[$AttribID])));
}
}
#-----------------------------------------------------------------------------
if (Count($Childs = $Object->Childs)) {
#---------------------------------------------------------------------------
$Content = new Tag('DIV', array('style' => 'display:none;'), array('id' => $Md5));
#---------------------------------------------------------------------------
foreach ($Childs as $Child) {
$Content->AddChild(XML_Read($Child, $Level + 1));
}
#---------------------------------------------------------------------------
$Node->AddChild($Content);
}
#-----------------------------------------------------------------------------
return $Node;
}
示例6: Array_Cut
function Array_Cut(&$What, $Whom, $IsFull = FALSE)
{
/****************************************************************************/
$__args_types = array('array', 'array', 'boolean');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
foreach (Array_Keys($Whom) as $Key) {
#---------------------------------------------------------------------------
if (isset($What[$Key])) {
#-------------------------------------------------------------------------
$ElementA =& $What[$Key];
$ElementB = $Whom[$Key];
#-------------------------------------------------------------------------
if (Is_Array($ElementA) && Is_Array($ElementB)) {
#-----------------------------------------------------------------------
Array_Cut($ElementA, $ElementB, $IsFull);
#-----------------------------------------------------------------------
if ($IsFull && !Count($ElementA)) {
unset($What[$Key]);
}
} else {
unset($What[$Key]);
}
}
}
}
示例7: submit
function submit()
{
$this->load->library('form_validation');
$app_comment = $this->input->post('app_comment');
$valueapp = $this->input->post('btn');
$this->form_validation->set_rules('app_comment', 'Approval Comment', 'required');
$this->form_validation->set_error_delimiters('<span class="help-block" style="color:red">', '</span>');
if ($this->form_validation->run() == FALSE) {
$this->view($this->session->userdata('l_view'));
} else {
if ($this->session->userdata('leave') == 0) {
//nampilih greenbox di view
$this->session->set_userdata('noticebox', '6');
if ($valueapp == "approve") {
$data = array('appv' => $this->session->userdata('userid'), 'docstatus' => '1', 'appv_comment' => $app_comment, 'app_date' => date('Y-m-d H:i:s'));
$this->db->where('leaveid', $this->session->userdata('eleaveid'));
$this->db->update('tr_leave', $data);
$recordatt = $this->m_leave->attendanceleave($this->session->userdata('l_view'));
for ($i = 0; $i < Count($recordatt); $i++) {
$dataattd = array('leavetype' => $recordatt[$i]['leavetype'], 'leavetype_c' => '1', 'Form_docno' => $recordatt[$i]['leaveid'], 'Form_type' => 'L');
$this->db->where('userid', $recordatt[$i]['userid']);
$this->db->where('date', $recordatt[$i]['date']);
$this->db->update('attendance', $dataattd);
}
$this->index();
} else {
if ($valueapp == "reject") {
$data = array('appv' => $this->session->userdata('userid'), 'docstatus' => '2', 'appv_comment' => $app_comment, 'app_date' => date('Y-m-d H:i:s'));
$this->db->where('leaveid', $this->session->userdata('eleaveid'));
$this->db->update('tr_leave', $data);
$this->index();
}
}
} else {
if ($this->session->userdata('leave') == 1) {
$this->session->set_userdata('noticebox', '6');
if ($valueapp == "approve") {
$data = array('appv' => $this->session->userdata('userid'), 'docstatus' => '1', 'appv_comment' => $app_comment, 'app_date' => date('Y-m-d H:i:s'));
$this->db->where('leaveid', $this->session->userdata('eleaveid'));
$this->db->update('tr_leave', $data);
$recordatt = $this->m_leave->getscheduletime($this->session->userdata('l_view'));
for ($i = 0; $i < Count($recordatt); $i++) {
$dataattd = array('remark_c' => '1', 'remark' => $recordatt[$i]['formtype'], 'Form_docno' => $recordatt[$i]['leaveid'], 'Form_type' => 'W');
$this->db->where('userid', $recordatt[$i]['userid']);
$this->db->where('date', $recordatt[$i]['date']);
$this->db->update('attendance', $dataattd);
}
$this->index();
} else {
if ($valueapp == "reject") {
$data = array('appv' => $this->session->userdata('userid'), 'docstatus' => '2', 'appv_comment' => $app_comment, 'app_date' => date('Y-m-d H:i:s'));
$this->db->where('leaveid', $this->session->userdata('eleaveid'));
$this->db->update('tr_leave', $data);
$this->index();
}
}
}
}
}
}
示例8: GetLicenseText
function GetLicenseText($DecodedString = false)
{
$Arr1 = array();
$License = array();
$DecodedString = trim($DecodedString);
if (!$DecodedString) {
return false;
}
$Arr1 = explode("\n", $DecodedString);
for ($i = 0; $i < count($Arr1); $i++) {
$Arr2 = explode("=", $Arr1[$i]);
if (!is_array($Arr2) || Count($Arr2) < 2) {
continue;
}
$License[$Arr2[0]] = str_replace("&equal;", "=", $Arr2[1]);
}
if (count($License) == 0) {
return false;
}
if (!isset($License['ID'])) {
return false;
}
if (!isset($License['V'])) {
return false;
}
if (!isset($License['CL'])) {
return false;
}
if (!isset($License['L'])) {
return false;
}
//if (!isset($License['L2'])) return false;
return $License;
}
示例9: GetCurrentCollection
private function GetCurrentCollection()
{
$uri = preg_split('@/@', CommonController::GetCurrentUri(), NULL, PREG_SPLIT_NO_EMPTY);
$CollectionId = $uri[Count($uri) - 1];
$WSCtrl = new WebServicesController();
return $WSCtrl->Call("Collection", "GET", [$CollectionId]);
}
示例10: checkUserBecome
public function checkUserBecome($user_id, $blog_id)
{
$table = Engine_Api::_()->getDbTable('becomes', 'ynblog');
$name = $table->info('name');
$select = $table->select()->where("{$name}.user_id = ?", $user_id)->where("{$name}.blog_id = ?", $blog_id);
$rows = $table->fetchAll($select);
return Count($rows) > 0 ? false : true;
}
示例11: login_users
public function login_users($nick, $password)
{
if (empty($nick)) {
return false;
}
if (empty($password)) {
return false;
}
$this->usuario = $this->modelo->obtenerUsuario($nick);
/*
//Verificar si el usuario está logueado
$session_id = $this->usuario->GET('session_id');
if($session_id != "" && $session_id!= session_id())
{
session_destroy();
return false;
}
*/
//si existe el usuario
if (Count($this->usuario) == 1) {
if ($this->usuario->__GET('int_borrado') == 1) {
return false;
}
$pass;
switch ($this->metodo_encriptacion) {
case 'sha1' | 'SHA1':
$pass = sha1($password);
break;
case 'md5' | 'MD5':
$pass = md5($password);
break;
case 'texto' | 'TEXTO':
$pass = $password;
break;
default:
trigger_error('El valor de la propiedad metodo_encriptacion no es válido. Utiliza MD5 o SHA1 o TEXTO', E_USER_ERROR);
}
if ($this->usuario->__GET('password') == $pass) {
// @session_start();
//almacenamos en memoria los datos del usuario
$_SESSION['USUARIO'] = array('user' => $this->usuario->__GET('correo'), 'nombre' => $this->usuario->__GET('nombre'), 'apellido' => $this->usuario->__GET('apellido'), 'cedula' => $this->usuario->__GET('id_user'), 'utype' => $this->usuario->__GET('user_type'), 'departamento' => $this->usuario->__GET('departamento'), 'codigo_usuario' => $this->usuario->__GET('codigo_usuario'), 'estado' => $this->usuario->__GET('estado'), 'tiempo' => date("H:i:s"));
return true;
//usuario y contraseña validadas
/*
echo $this->usuario->__GET('password')."<br>";
echo $this->usuario->__GET('primer_nombre')."<br>";
echo $this->usuario->__GET('segundo_nombre')."<br>";
echo $this->usuario->__GET('primer_apellido')."<br>";
echo $this->usuario->__GET('segundo_apellido')."<br>";
*/
}
} else {
//@session_start();
//unset($_SESSION['USUARIO']); //destruimos la session activa al fallar el login por si existia
return false;
//no coincide la contraseña
}
}
示例12: ArraySum
function ArraySum($Array)
{
$N = 0;
$Array = array_values($Array);
for ($Count = Count($Array), $i = 0; $i < $Count; $i++) {
$N = Summation($N, $Array[$i]);
}
return $N;
}
示例13: getNumberOfGalleries
function getNumberOfGalleries($limit = -1)
{
static $count;
if ($count) {
return $count;
} else {
return $count = Count(Get_Posts(array('post_type' => $this->post_type, 'post_status' => 'any', 'numberposts' => $limit)));
}
}
示例14: reserveRoom
public static function reserveRoom($data)
{
$param_string = '';
foreach ($data as $key => $value) {
$param_string .= $key . '=' . $value . '&';
}
rtrim($param_string, '&');
$result = self::sendData('Rooms', $param_string, Count($data));
return $result;
}
示例15: Menu2
function Menu2($items)
{
global $sess;
$this->perm_mbr = $sess[5];
$count = Count($items);
for ($i = 0; $i < $count; $i++) {
$this->names[] = $items['id'][$i];
$this->urls[] = $items['name'][$i];
}
}