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


PHP Count函数代码示例

本文整理汇总了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();
     }
 }
开发者ID:kielnevec,项目名称:PORTAL_Ingress_by_Fingertec,代码行数:28,代码来源:remove_ot.php

示例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;
}
开发者ID:carriercomm,项目名称:jbs,代码行数:31,代码来源:Styles.php

示例3: get_MaxValueByControlId

	function get_MaxValueByControlId($ControlId) {
		$VariableObject = IPS_GetVariable($ControlId);
		$ProfileName = $VariableObject['VariableCustomProfile'];
		$ProfileObject = IPS_GetVariableProfile($ProfileName);
		$MaxValue = Count($ProfileObject['Associations']);
		return $MaxValue;
	}
开发者ID:KOS-CH,项目名称:IPSLibrary,代码行数:7,代码来源:Entertainment_Device.inc.php

示例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);
     }
 }
开发者ID:Nemeziz,项目名称:googletwitter,代码行数:33,代码来源:loadIntoData.php

示例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;
}
开发者ID:carriercomm,项目名称:jbs,代码行数:35,代码来源:Repository.comp.php

示例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]);
            }
        }
    }
}
开发者ID:carriercomm,项目名称:jbs,代码行数:28,代码来源:Arrays.php

示例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();
                     }
                 }
             }
         }
     }
 }
开发者ID:kielnevec,项目名称:PORTAL_Ingress_by_Fingertec,代码行数:60,代码来源:approve.php

示例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;
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:34,代码来源:license.func.php

示例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]);
 }
开发者ID:CrunchyArtie,项目名称:Audio,代码行数:7,代码来源:CollectionController.php

示例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;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:8,代码来源:Core.php

示例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
     }
 }
开发者ID:vanckruz,项目名称:draftReports,代码行数:58,代码来源:class.Login.php

示例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;
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:9,代码来源:functions.number.php

示例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)));
     }
 }
开发者ID:Gculos,项目名称:farmcosales,代码行数:9,代码来源:class.mocking-bird.php

示例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;
 }
开发者ID:andsci,项目名称:hotels,代码行数:10,代码来源:Model.php

示例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];
     }
 }
开发者ID:steviedeeee,项目名称:mutual-credit-uniletim,代码行数:10,代码来源:menu.class.php


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