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


PHP int函数代码示例

本文整理汇总了PHP中int函数的典型用法代码示例。如果您正苦于以下问题:PHP int函数的具体用法?PHP int怎么用?PHP int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: is_consistency

function is_consistency($arr_of_parse, $arr_of_result)
{
    if (array_key_exists('empty', $arr_of_result)) {
        if ($arr_of_parse["msg"] == "no matched pattern") {
            return true;
        } else {
            return false;
        }
    } else {
        if ($arr_of_parse["code"] == "100") {
            $arr = array();
            if (isset($arr_of_parse["global"])) {
                $arr = $arr_of_parse["global"];
            }
            //获取解析后的数据信息
            foreach ($arr as $key => $value) {
                $val = int(float($value));
                if (int($arr_of_result[$key]) != $val) {
                    return false;
                }
            }
            return true;
        } else {
            return false;
        }
    }
}
开发者ID:disibutatian,项目名称:parsesms,代码行数:27,代码来源:test.php

示例2: getlist

 public static function getlist($job_id = null, $output = null, $page = 0, $size = 20)
 {
     $page = int($page);
     $size = int($size);
     if ($size > 100) {
         $size = 100;
     }
     $sql = 'select * from wm_jobs_history ';
     $cond = '';
     $params = [];
     if ($job_id !== null) {
         if (!empty($cond)) {
             $cond += ' and ';
         }
         $cond += 'job_id = :job_id';
         $params[':job_id'] = $job_id;
     }
     if ($output !== null) {
         if (!empty($cond)) {
             $cond += ' and ';
         }
         $cond += 'output = :output';
         $params[':output'] = $output;
     }
     $sql += ' where ' + $cond + ' limit ' + $page * $size + ',' + $size;
     return JobHistoryModel::findBySql($sql, $params) . all();
 }
开发者ID:cychenyin,项目名称:postmill,代码行数:27,代码来源:JobHistoryModel.php

示例3: paginate

 public function paginate($page, $per_page = 20, $where = '')
 {
     $page = abs(int($page)) - 1;
     $skip = ($page - 1) * $per_page;
     $sql = "SELECT * FROM `{$this->table}` {$where} LIMIT {$per_page} OFFSET {$skip}";
     return db_get_all($sql);
 }
开发者ID:nguyenquang2302,项目名称:BlogTaoLao,代码行数:7,代码来源:model.php

示例4: UploadImageSlots

function UploadImageSlots()
{
    global $ImageSlots;
    global $ImageParameters;
    foreach ($ImageSlots as $sl => $slot) {
        $img;
        if (isset($_FILES['upload_image_slot_' . $sl]['tmp_name'])) {
            $img = imagecreatefromjpeg($_FILES['upload_image_slot_' . $sl]['tmp_name']);
        } elseif (isset($_FILES['url_image_slot_' . $sl]) && $_FILES['url_image_slot_' . $sl] != '') {
            $img = imagecreatefromjpeg($_FILES['url_image_slot_' . $sl]);
        }
        if ($img) {
            $wd = imagesx($img);
            $ht = imagesy($img);
            foreach ($slot['images'] as $ikey) {
                $ipar = $ImageParameters[$ikey];
                $wd2 = $ipar['width'];
                $ht2 = $ipar['height'];
                $sc = min($wd2 / $wd, $ht2 / $ht);
                $img2 = imagecreatetruecolor($wd2, $ht2);
                imagecopyresized($img2, $img, int(($wd2 - $wd * $sc + 1) / 2), int(($ht2 - $ht * $sc + 1) / 2), 0, 0, int($wd * $sc + 0.5), int($ht * $sc + 0.5), $wd, $ht);
                $dir = DIR_FS_CATALOG_IMAGES . $ikey . '/';
                mkdir($dir, 0755);
                imagejpeg($img2, $dir . $img_filename, isset($ipar['quality']) ? $ipar['quality'] : 75);
            }
        }
    }
}
开发者ID:rrecurse,项目名称:IntenseCart,代码行数:28,代码来源:image_resizer.php

示例5: colname

 static function colname($col)
 {
     if ($col < 26) {
         return chr($col + 65);
     } else {
         $x = int($col / 26);
         return chr($x + 65) . chr($col % 26 + 65);
     }
 }
开发者ID:benesch,项目名称:peteramati,代码行数:9,代码来源:xlsx.php

示例6: safeid

function safeid($v)
{
    if (strstr($v, ",")) {
        $arr = explode(',', $v);
        foreach ($arr as $val) {
            $value[] = (int) $val;
        }
        $v = implode(',', $value);
    } elseif (is_array($v)) {
        foreach ($v as $val) {
            $value[] = (int) $val;
        }
        $v = $value;
    } else {
        $v = int($v);
    }
    return $v;
}
开发者ID:keyu199314,项目名称:php,代码行数:18,代码来源:db.safety.php

示例7: create_job

function create_job($ticket, $values)
{
    $CI =& get_instance();
    $product = $ticket['product'];
    $to = $values['to'];
    $agent = get_user_by_id($ticket['agent']);
    $price = get_price($product['id'], $agent['level']);
    if (!change_credit($agent['id'], -$price, $ticket['number'])) {
        return 'INSUFFICIENT_BALANCE_FROM_AGENT';
    }
    if ($product['cate'] == 4) {
        $this->load->helper('user');
        $user = get_user();
        if (!$user) {
            return 'LOGIN_REQUIRED';
        }
        // hack self business here
        if ($product['subcate'] == 900) {
            // increase balance
            change_credit($user['id'], $product['norm_value'], $ticket['number']);
        }
        if ($product['subcate'] == 910) {
            // upgrade agent
            $from = $product['province'] % 10;
            $to = int($product['province'] / 10);
            if ($user['level'] != $from) {
                return 'INVALID_CURRENT_LEVEL';
            }
            if ($user['parent'] && $user['parent'] != $ticket['agent']) {
                return 'PARENT_CONFLICTED';
            }
            $this->db->update('agent', array('level' => $to, 'parent' => $ticket['agent']), array('name' => $username));
        }
    } else {
        $this->db->insert('job', array('create_time' => time(), 'commit_time' => 0, 'ticket_number' => $ticket['number'], 'to' => $values['to'], 'area' => $values['area'], 'product_id' => $product['id'], 'locking_on' => NULL, 'retried' => 0, 'result' => 0, 'reason' => NULL));
    }
    return 'SUCCESS';
}
开发者ID:sdgdsffdsfff,项目名称:raptor,代码行数:38,代码来源:product_helper.php

示例8: get_last_release

 function get_last_release()
 {
     $result = sql_do('SELECT id_rel FROM releases WHERE date_rel like (SELECT max(date_rel) FROM releases) AND id_branch=\'' . int($this->get_id_branch()) . '\'');
     if ($result->numRows() == 0) {
         return 0;
     } else {
         $row = $result->fetchRow();
         return $row[0];
     }
 }
开发者ID:BackupTheBerlios,项目名称:igoan-svn,代码行数:10,代码来源:Branch.class.php

示例9: nxs_ogtgCallback

 function nxs_ogtgCallback($content)
 {
     global $post, $plgn_NS_SNAutoPoster;
     if (stripos($content, 'og:title') !== false) {
         $ogOut = "\r\n";
     } else {
         if (!isset($plgn_NS_SNAutoPoster)) {
             $options = get_option('NS_SNAutoPoster');
         } else {
             $options = $plgn_NS_SNAutoPoster->nxs_options;
         }
         $ogimgs = array();
         if (!empty($post) && !is_object($post) && int($post) > 0) {
             $post = get_post($post);
         }
         if (empty($options['advFindOGImg'])) {
             $options['advFindOGImg'] = 0;
         }
         $title = preg_match('/<title>(.*)<\\/title>/', $content, $title_matches);
         if ($title !== false && count($title_matches) == 2) {
             $ogT = '<meta property="og:title" content="' . $title_matches[1] . '" />' . "\r\n";
         } else {
             if (is_home() || is_front_page()) {
                 $ogT = get_bloginfo('name');
             } else {
                 $ogT = get_the_title();
             }
             $ogT = '<meta property="og:title" content="' . esc_attr(apply_filters('nxsog_title', $ogT)) . '" />' . "\r\n";
         }
         $prcRes = preg_match('/<meta name="description" content="(.*)"/', $content, $description_matches);
         if ($prcRes !== false && count($description_matches) == 2) {
             $ogD = '<meta property="og:description" content="' . $description_matches[1] . '" />' . "\r\n";
         }
         if (!empty($post) && is_object($post) && is_singular()) {
             if (has_excerpt($post->ID)) {
                 $ogD = strip_tags(nxs_snapCleanHTML(get_the_excerpt($post->ID)));
             } else {
                 $ogD = str_replace("  ", ' ', str_replace("\r\n", ' ', trim(substr(strip_tags(nxs_snapCleanHTML(strip_shortcodes($post->post_content))), 0, 200))));
             }
         } else {
             $ogD = get_bloginfo('description');
         }
         $ogD = preg_replace('/\\r\\n|\\r|\\n/m', '', $ogD);
         $ogD = '<meta property="og:description" content="' . esc_attr(apply_filters('nxsog_desc', $ogD)) . '" />' . "\r\n";
         $ogSN = '<meta property="og:site_name" content="' . get_bloginfo('name') . '" />' . "\r\n";
         $ogLoc = strtolower(esc_attr(get_locale()));
         if (strlen($ogLoc) == 2) {
             $ogLoc .= "_" . strtoupper($ogLoc);
         }
         $ogLoc = '<meta property="og:locale" content="' . $ogLoc . '" />' . "\r\n";
         $iss = is_home();
         $ogType = is_singular() ? 'article' : 'website';
         if (empty($vidsFromPost)) {
             $ogType = '<meta property="og:type" content="' . esc_attr(apply_filters('nxsog_type', $ogType)) . '" />' . "\r\n";
         }
         if (is_home() || is_front_page()) {
             $ogUrl = get_bloginfo('url');
         } else {
             $ogUrl = 'http' . (is_ssl() ? 's' : '') . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         }
         $ogUrl = '<meta property="og:url" content="' . esc_url(apply_filters('nxsog_url', $ogUrl)) . '" />' . "\r\n";
         if (!is_home()) {
             /*
                   $vidsFromPost = nsFindVidsInPost($post); if ($vidsFromPost !== false && is_singular()) {  echo '<meta property="og:video" content="http://www.youtube.com/v/'.$vidsFromPost[0].'" />'."\n";  
                   echo '<meta property="og:video:type" content="application/x-shockwave-flash" />'."\n";
                   echo '<meta property="og:video:width" content="480" />'."\n";
                   echo '<meta property="og:video:height" content="360" />'."\n";
                   echo '<meta property="og:image" content="http://i2.ytimg.com/vi/'.$vidsFromPost[0].'/mqdefault.jpg" />'."\n";
                   echo '<meta property="og:type" content="video" />'."\n"; 
                 } */
             if (is_object($post)) {
                 $imgURL = nxs_getPostImage($post->ID, 'full', $options['ogImgDef']);
                 if (!empty($imgURL)) {
                     $ogimgs[] = $imgURL;
                 }
                 $imgsFromPost = nsFindImgsInPost($post, (int) $options['advFindOGImg'] == 1);
                 if ($imgsFromPost !== false && is_singular() && is_array($ogimgs) && is_array($imgsFromPost)) {
                     $ogimgs = array_merge($ogimgs, $imgsFromPost);
                 }
             }
         }
         //## Add default image to the endof the array
         if (count($ogimgs) < 1 && isset($options['ogImgDef']) && $options['ogImgDef'] != '') {
             $ogimgs[] = $options['ogImgDef'];
         }
         //## Output og:image tags
         $ogImgsOut = '';
         if (!empty($ogimgs) && is_array($ogimgs)) {
             foreach ($ogimgs as $ogimage) {
                 $ogImgsOut .= '<meta property="og:image" content="' . esc_url(apply_filters('ns_ogimage', $ogimage)) . '" />' . "\r\n";
             }
         }
         $ogOut = "\r\n" . $ogSN . $ogT . $ogD . $ogType . $ogUrl . $ogLoc . $ogImgsOut;
     }
     $content = str_ireplace('<!-- ## NXSOGTAGS ## -->', $ogOut, $content);
     return $content;
 }
开发者ID:digideskio,项目名称:stammtisch,代码行数:97,代码来源:NextScripts_SNAP.php

示例10: get_last_release

 function get_last_release()
 {
     $result = sql_do('SELECT id_rel FROM ' . DB_PREF . '_releases JOIN ' . DB_PREF . '_branches USING (id_branch) JOIN ' . DB_PREF . '_projects USING (id_prj) WHERE ' . DB_PREF . '_branches.id_branch=' . DB_PREF . '_projects.default_branch AND ' . DB_PREF . '_projects.id_prj=\'' . int($this->get_id_prj()) . '\' ORDER BY date_rel DESC LIMIT 1');
     if ($result->numRows() == 0) {
         return 0;
     } else {
         $row = $result->fetchRow();
         return $row[0];
     }
 }
开发者ID:BackupTheBerlios,项目名称:igoan-svn,代码行数:10,代码来源:Project.class.php

示例11: volume_set

 /**
  * volume_set
  * This isn't a required function, it sets the volume to a specified value
  * as passed in the variable it is a 0 - 100 scale the controller is
  * responsible for adjusting the scale if nessecary
  */
 public function volume_set($value)
 {
     /* Make sure it's int and 0 - 100 */
     $value = int($value);
     /* Make sure that it's between 0 and 100 */
     if ($value > 100 or $value < 0) {
         return false;
     }
     if (!$this->_player->volume($value)) {
         debug_event('localplay', 'Error: Unable to set volume, check ' . $this->type . ' controller', '1');
         return false;
     }
     return true;
 }
开发者ID:ivan801,项目名称:ampache,代码行数:20,代码来源:localplay.class.php

示例12: _write_url_internal

 function _write_url_internal()
 {
     $_ = func_get_args();
     $record = 0x1b8;
     # Record identifier
     $length = 0x0;
     # Bytes to follow
     $row1 = $_[0];
     # Start row
     $col1 = $_[1];
     # Start column
     $row2 = $_[2];
     # End row
     $col2 = $_[3];
     # End column
     $url = $_[4];
     # URL string
     if (isset($_[5])) {
         $str = $_[5];
         # Alternative label
     }
     $xf = $_[6] ? $_[6] : $this->_url_format;
     # The cell format
     # Strip URL type
     $url = preg_replace('s[^internal:]', '', $url);
     # Write the visible label
     if (!isset($str)) {
         $str = $url;
     }
     $str_error = $this->write_string($row1, $col1, $str, $xf);
     if ($str_error == -2) {
         return $str_error;
     }
     # Pack the undocumented parts of the hyperlink stream
     $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
     # Pack the option flags
     $options = pack("V", 0x8);
     # Convert the URL type and to a null terminated wchar string
     $url = join("", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY));
     $url = $url . "";
     # Pack the length of the URL as chars (not wchars)
     $url_len = pack("V", int(strlen($url) / 2));
     # Calculate the data length
     $length = 0x24 + strlen($url);
     # Pack the header data
     $header = pack("vv", $record, $length);
     $data = pack("vvvv", $row1, $row2, $col1, $col2);
     # Write the packed data
     $this->_append($header . $data . $unknown1 . $options . $url_len . $url);
     return $str_error;
 }
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:51,代码来源:class.writeexcel_worksheet.inc.php

示例13: delCart

 /**
  * 删除我的购物车的东西
  *
  * @author   kylin <kylinlxl@126.com>
  * @param    maxed $aid
  * @access   public
  * @return   JSON
  */
 public function delCart()
 {
     $idArr = I('get.aid');
     $model = M('ad_carts');
     $uid = session('userID');
     $where['uid'] = $uid;
     if (is_array($idArr)) {
         $where['aid'] = array('in', $idArr);
     } else {
         $where['aid'] = int($idArr);
     }
     $res = $model->where($where)->delete();
     if ($res !== false) {
         $status = true;
     } else {
         $status = false;
     }
     $this->ajaxReturn($status, 'json');
 }
开发者ID:anLl,项目名称:ybirds,代码行数:27,代码来源:AdvController.class.php

示例14: updateGroup

 public function updateGroup($id, $group_id)
 {
     global $webdb;
     $webdb->query("UPDATE " . $this->tableName . " SET group_id = '" . int($group_id) . "'  WHERE id = '" . (int) $id . "'");
 }
开发者ID:austinliniware,项目名称:tsci-rota,代码行数:5,代码来源:registration.class.php

示例15: get_last_release

 function get_last_release()
 {
     $result = sql_do('select id_rel from releases join branches using (id_branch) join projects using (id_prj) where id_branch=default_branch and id_prj=\'' . int($this->get_id_prj()) . '\' order by date_rel desc limit 1');
     if ($result->numRows() == 0) {
         return 0;
     } else {
         $row = $result->fetchRow();
         return $row[0];
     }
 }
开发者ID:BackupTheBerlios,项目名称:igoan-svn,代码行数:10,代码来源:Project.class.php


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