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


PHP parseInt函数代码示例

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


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

示例1: parseResult

 private function parseResult(Game $game, Htmldom $html)
 {
     $score1Row = $html->find('table.match-day td.score span.score b.score-h', 0);
     $score2Row = $html->find('table.match-day td.score span.score b.score-a', 0);
     if ($score1Row != null && $score2Row != null) {
         $data = ['score1' => parseInt($score1Row->innertext), 'score2' => parseInt($score2Row->innertext)];
         $validator = Validator::make($data, ['score1' => 'required|integer', 'score2' => 'required|integer']);
         if (!$validator->fails()) {
             (new GameRepository())->saveScore($game, $data);
             return true;
         }
     }
     return false;
 }
开发者ID:AlexYaroma,项目名称:mightyducks,代码行数:14,代码来源:ParseResult.php

示例2: parseDateInt

 function parseDateInt($dateInt)
 {
     $dateInt = (string) $dateInt;
     if ($dateInt[0] == "0" && strlen($dateInt) != 1) {
         $dateInt = $dateInt[1];
     }
     if (isNaN(parseInt($dateInt))) {
         return "0";
     }
     if (strlen($dateInt) == 1) {
         $dateInt = "0" . $dateInt;
     }
     return $dateInt;
 }
开发者ID:r007,项目名称:PMoodle,代码行数:14,代码来源:NumDate.php

示例3: array

<?php

/* config.js */
$params->PageBgColor = $params->PageBgColor ? $params->PageBgColor : "#d7d7d7";
$slideshow_css = '$CssPath$style.css';
$thumbs = (object) array('margin' => 3, 'padding' => 3);
$params->Border = parseInt($params->noFrame) ? "none" : "1px solid rgba(255, 255, 255, 0.4)";
array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/bullet.png'));
array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/arrows.png'));
array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/play.png'));
array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/pause.png'));
if ($params->ShowTooltips) {
    $params->ThumbWidthHalf = round($params->ThumbWidth / 2);
    array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/triangle-' . $params->TooltipPos . '.png', 'dest' => '$ImgPath$triangle.png'));
    array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/style-tooltip.css', 'dest' => $slideshow_css, 'filters' => array('params')));
}
// call this function at the end of each template
finalize();
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:18,代码来源:config.php

示例4: getValidationMessage

 static function getValidationMessage($validation)
 {
     $type = $validation['type'];
     $param = '';
     if (isset($validation['param'])) {
         $param = $validation['param'];
     }
     switch ($type) {
         case 'min':
             return t('Value must be higher than %s.', $param);
             break;
         case 'length':
             if (parseInt($param) > 1) {
                 return t('Value must be at least %s characters long.', $param);
             } else {
                 return t('This field cannot be empty.');
             }
             break;
         case 'maxlen':
             return t('Maximum length is %s characters.', $param);
             break;
         case 'email':
             return t('Please enter valid e-mail address.');
             break;
         case 'date':
             return t('Please enter valid date.');
             break;
         case 'ip':
             return t('Please enter valid IP address.');
             break;
         case 'integer':
             return t('Please enter whole number.');
             break;
         case 'decimal':
         case 'price':
             return t('Please enter valid decimal number.');
             break;
         default:
             return t('Required.');
     }
 }
开发者ID:lotcz,项目名称:zshop,代码行数:41,代码来源:forms.php

示例5: SplClassLoader

$tree->register();
$tree = new Tree\NestedTree\NestedTree(prefix_table("nested_tree"), 'id', 'parent_id', 'title');
//Load AES
$aes = new SplClassLoader('Encryption\\Crypt', '../includes/libraries');
$aes->register();
// CASE where title is changed
if (isset($_POST['newtitle'])) {
    $id = explode('_', $_POST['id']);
    //update DB
    DB::update(prefix_table("nested_tree"), array('title' => mysqli_escape_string($link, stripslashes($_POST['newtitle']))), "id=%i", $id[1]);
    //Show value
    echo $_POST['newtitle'];
    // CASE where RENEWAL PERIOD is changed
} elseif (isset($_POST['renewal_period']) && !isset($_POST['type'])) {
    //Check if renewal period is an integer
    if (parseInt(intval($_POST['renewal_period']))) {
        $id = explode('_', $_POST['id']);
        //update DB
        DB::update(prefix_table("nested_tree"), array('renewal_period' => mysqli_escape_string($link, stripslashes($_POST['renewal_period']))), "id=%i", $id[1]);
        //Show value
        echo $_POST['renewal_period'];
    } else {
        //Show ERROR
        echo $LANG['error_renawal_period_not_integer'];
    }
    // CASE where the parent is changed
} elseif (isset($_POST['newparent_id'])) {
    $id = explode('_', $_POST['id']);
    //Store in DB
    DB::update(prefix_table("nested_tree"), array('parent_id' => $_POST['newparent_id']), "id=%i", $id[1]);
    //Get the title to display it
开发者ID:ariostea74,项目名称:TeamPass,代码行数:31,代码来源:folders.queries.php

示例6: AdminForm

<?php

require_once $home_dir . 'models/category.m.php';
require_once $home_dir . 'models/alias.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('category');
$page = 'admin/form';
$form->add([['name' => 'category_name', 'label' => 'Name', 'type' => 'text'], ['name' => 'alias_url', 'label' => 'Alias', 'type' => 'text'], ['name' => 'category_parent_id', 'label' => 'Parent Category', 'type' => 'select', 'select_table' => 'categories', 'select_id_field' => 'category_id', 'select_label_field' => 'category_name']]);
if (isset($_POST['category_id'])) {
    $category = new Category($db, $_POST['category_id']);
    $category->setData($form->processInput($_POST));
    $category->data['category_parent_id'] = parseInt($category->val('category_parent_id'));
    $alias_url = $category->val('alias_url');
    unset($category->data['alias_url']);
    $category->save();
    $alias = new Alias($db, $category->ival('category_alias_id'));
    // save alias if new or changed
    if ($alias->val('alias_url') != $alias_url || !$alias->is_loaded) {
        $alias->data['alias_path'] = $category->getAliasPath();
        if (isset($alias_url) && strlen(trim($alias_url)) > 0) {
            $alias->setUrl($alias_url);
        } else {
            $alias->setUrl($category->getAliasUrl());
        }
        $alias->save();
    }
    // update category alias if changed
    if ($alias->ival('alias_id') != $category->ival('category_alias_id')) {
        $category->data['category_alias_id'] = $alias->ival('alias_id');
        $category->save();
    }
开发者ID:lotcz,项目名称:zshop,代码行数:31,代码来源:category.c.php

示例7: getParameter

<?php

// ContenidoLogica
$cont = null;
// String
$tipocont = null;
try {
    // 	String
    $id_cont = request . getParameter("id");
    // 	int
    $id = 0;
    try {
        $id = Integer . parseInt($id_cont);
    } catch (NumberFormatException $ex) {
    }
    $cont = ContenidoLogica . Buscar(id);
    $tipocont = cont . getTipo() . toString() . toLowerCase();
} catch (NullPointerException $e) {
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ver Capitulo</title>
<!-- <link rel='stylesheet' type='text/css'  href="../Scripts/stylesWeb2.css">  -->
<link rel='stylesheet' type='text/css' href="../Scripts/jquery-ui.min.css">
<script type="text/javascript" src="../Scripts/jquery-2.0.0.min.js" ></script>
<script type="text/javascript" src="../Scripts/jquery.validate.min.js" ></script>
<script type="text/javascript" src="../Scripts/jquery-ui.min.js" ></script>
<script type="text/javascript" src="../Scripts/ajaxRequestScript.js" ></script>
<script type="text/javascript" src="../Scripts/ContenidoBindings.js"></script>
开发者ID:villafloresmf,项目名称:EntorGrafFinal,代码行数:31,代码来源:VerCapitulo.php

示例8: editCertificateUserRecord

function editCertificateUserRecord($recid, $certid, $serial, $version, $issue, $expire, $filename)
{
    $result = false;
    $record = get_record('certificate_records', 'id', $recid);
    $record->certificateid = parseInt($certid);
    $record->serial_number = addslashes($serial);
    $record->version_code = addslashes($version);
    $record->issue_date = $issue;
    $record->expire_date = $expire;
    if (!empty($filename)) {
        if (!empty($record->filename)) {
            if (fileDelete("", $record->filename)) {
                //echo "File deleted. - ".$record->filename;
                $filechanged = true;
            } else {
                //echo "Cannot delete file. - ".$record->filename;
                $filechanged = false;
            }
        } else {
            $filechanged = true;
        }
    }
    //echo "File: ".$record->filename." -> ".$filename."<br/>";
    //if($filechanged){
    if (!file_exists($record->filename) && file_exists($filename)) {
        $record->filename = $filename;
    }
    $recordid = update_record('certificate_records', $record);
    if ($recordid > 0) {
        $result = true;
    }
    return $result;
    //$sql_str = "INSERT INTO mdl_certificate_records (title,description) VALUES('$title','$desc')";
    //echo $sql_str;
    //return execute_sql($sql_str);
}
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:36,代码来源:verifyfunctions.php

示例9: _gi

function _gi($name, $def = null)
{
    return parseInt(_g($name, $def));
}
开发者ID:lotcz,项目名称:zshop,代码行数:4,代码来源:functions.php

示例10: setName

 private function setName($name)
 {
     $this->name = $name;
     $this->number = parseInt($this->name, 10);
     $this->calculateHexagonXY();
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:6,代码来源:Hexagon.php

示例11: parsePowerData

if ($data['sphData']) {
    $sphArray = parsePowerData($data['sphData']);
    $arr['maxplus'] = max($sphArray);
    $arr['maxminus'] = min($sphArray);
}
if ($data['cylPwrData']) {
    $cylArray = parsePowerData($data['cylPwrData']);
    //remember - the cyl values will be minus powers!
    $arr['maxcylpower'] = min($cylArray);
}
if ($data['cylAxisData']) {
    $string = $data['cylAxisData'];
    $increment = 90;
    if (preg_match_all("/[0-9]*\\s*steps/", $data['cylAxisData'], $matches)) {
        foreach ($matches[0] as $steps) {
            $int = parseInt($steps);
            if ($int < $increment) {
                $increment = $int;
            }
        }
    }
    $arr['cylaxissteps'] = $increment;
    $dataArray = parseIntegerData($data['cylAxisData']);
    $arr['oblique'] = mostObliqueAxis($dataArray);
}
if ($data['addData']) {
    $addArray = parsePowerData($data['addData']);
    $arr['maxadd'] = max($addArray);
    //if (! is_numeric($arr['maxadd']) ) $arr['maxadd'] = null;
}
if (count($arr) > 0) {
开发者ID:grlf,项目名称:eyedock,代码行数:31,代码来源:x_clParamExtraction.php

示例12: __construct

 function __construct($pObject)
 {
     $this->obj = $pObject;
     $this->tag = $GLOBALS['controlType'][$this->obj->ControlType];
     $this->font_weight = $this->obj->FontWeight;
     $this->font_family = $this->obj->FontName;
     $alignment = array('left', 'left', 'center', 'right');
     $this->text_align = $alignment[$this->obj->TextAlign];
     if ($this->text_align == '') {
         $this->text_align = $this->obj->TextAlign;
     }
     $this->value = $this->obj->Value;
     if ($this->tag == 'Label') {
         $this->value = $this->obj->Caption;
     }
     if ($this->tag == 'Field') {
         $this->value = $this->obj->ControlSource;
     }
     if ($this->tag == 'Graph') {
         $this->obj->BackColor = 'black';
     }
     if ($this->tag == 'Graph') {
         $this->obj->ForeColor = 'white';
     }
     if ($this->tag == 'Graph') {
         $this->obj->FontSize = '10px';
     }
     if ($this->tag == 'PageBreak') {
         $this->obj->BorderColor = 'black';
     }
     if ($this->tag == 'PageBreak') {
         $this->obj->borderWidth = '4px';
     }
     if ($this->tag == 'PageBreak') {
         $this->obj->height = 4 * resize() . "px";
     }
     //Nick 21/07/09 added ."px"
     if ($this->tag == 'PageBreak') {
         $this->obj->width = 44 * resize() . "px";
     }
     //Nick 21/07/09 added ."px"
     if ($this->tag == 'PageBreak') {
         $this->obj->left = 0 * resize() . "px";
     }
     //Nick 21/07/09 added ."px"
     $this->name = $this->obj->Name;
     if (isNB()) {
         //-- is nuBuilder
         if ($this->tag == 'Graph') {
             $this->value = $this->obj->Value;
         }
         if ($this->tag == 'Graph') {
             $this->graph = $this->obj->Graph;
         }
         $this->font_size = parseInt($this->obj->FontSize) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->top = parseInt($this->obj->Top) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->left = parseInt($this->obj->Left) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->width = parseInt($this->obj->Width) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->height = parseInt($this->obj->Height) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
     } else {
         if ($this->tag == 'Graph') {
             $this->value = $this->obj->Tag;
         }
         if ($this->tag == 'Graph') {
             $this->graph = $this->obj->Name;
         }
         if ($this->font_family == 'Arial') {
             $this->font_size = floor(parseInt($this->obj->FontSize) * 1.3) . "px";
             //Nick 21/07/09 added ."px"
         } else {
             $this->font_size = floor(parseInt($this->obj->FontSize) * 1.5) . "px";
             //Nick 21/07/09 added ."px"
         }
         $this->top = parseInt($this->obj->Top * resize()) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->left = parseInt($this->obj->Left * resize()) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->width = parseInt($this->obj->Width * resize()) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->height = parseInt($this->obj->Height * resize()) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
     }
     $this->color = $this->obj->ForeColor;
     $this->back_ground_color = $this->obj->BackColor;
     $this->border_width = parseInt($this->obj->BorderWidth) . "px";
     //Nick 21/07/09 wrapped in parseInt()."px"
     $this->border_color = $this->obj->BorderColor;
     $this->border_style = $this->obj->BorderStyle;
     $this->can_grow = $this->obj->CanGrow;
     $textFormat = textFormatsArray();
     $this->format = $this->obj->Format;
     $this->HTML = $this->buildHTML();
 }
开发者ID:BackupTheBerlios,项目名称:nubuilder-svn,代码行数:98,代码来源:nureportbuilder.php

示例13: set

 /**
  * Instruction to add after query::update or query::insert
  * Set a value to a field
  *
  * @access public
  * @param mixed $field name of the field
  * @param String $value[optional] value of the field - default: ''
  * @return query $this pour assurer la chaînabilité de la classe
  */
 public function set($field = '', $value = '')
 {
     // Vérification de l'argument FIELD indispensable
     if (empty($field)) {
         debug::error("SQL", "FIELD argument must be valid in SET method.", __FILE__, __LINE__);
         $this->error = true;
     }
     // La méthode set ne peut être appelée après la méthode SELECT
     if ($this->content['select']) {
         debug::error("SQL", "SET method can't be requested with the SELECT method.", __FILE__, __LINE__);
         $this->error = true;
     }
     // Si le paramètre entré en est un array associatif, on met en place un multiple-set
     if (is_array($field)) {
         foreach ($field as $key => $value) {
             $this->set($key, $value);
         }
         return $this;
     }
     if ($this->content['update']) {
         if ($this->content['set']) {
             $this->prepare_request .= ', ';
         } else {
             $this->prepare_request .= ' SET';
         }
         if (preg_match("#^\\+([0-9]{1,11})\$#", $value)) {
             $this->prepare_request .= ' ' . $this->table['set'] . '_' . $field . ' = ' . $this->table['set'] . '_' . $field . ' + ' . parseInt($value) . '';
         } else {
             $this->prepare_request .= ' ' . $this->table['set'] . '_' . $field . ' = "' . addslashes($value) . '"';
         }
         $this->content['set'] = true;
     } elseif ($this->content['insert']) {
         $this->fields[] = $this->table['set'] . '_' . $field;
         $this->values[] = addslashes($value);
         $this->content['set'] = true;
     } else {
         debug::error("SQL", "SET method can't be requested before UPDATE or a INSERT method.", __FILE__, __LINE__);
         $this->error = true;
     }
     return $this;
 }
开发者ID:homework-bazaar,项目名称:SnakePHP,代码行数:50,代码来源:class.query.php

示例14: append_into_db_msg

 public function append_into_db_msg()
 {
     extract($_POST);
     $UNIX_TIME = parseInt(strtotime(date("Y-m-d H:i:s")));
     //+3600;
     $QUERY = "INSERT INTO chat values(NULL, {$id_user_writer} ,{$id_user_otherside} ,'{$msg}' , '" . $UNIX_TIME . "' )  ";
     mysql_query($QUERY, Conectar::con());
     $id_last_msg = mysql_insert_id();
     chat::get_msg_from_db_by_limit("justOneMSG", $id_user_writer);
     // obtenemos solo 1 msg
     notify::set_notify($id_last_msg);
     // metemos la notifycacion |||| pasamos ( user_writer , user_reader , id_chat);
 }
开发者ID:kudretgonuleri,项目名称:Chat-whatsapp-style,代码行数:13,代码来源:class.php

示例15: processForm

 public function processForm($form)
 {
     global $path, $page_title, $messages;
     if (isset($_POST[$this->id_name])) {
         if ($form->processInput($_POST)) {
             if (parseInt($_POST[$this->id_name]) > 0) {
                 $this->loadById($_POST[$this->id_name]);
             }
             $this->setData($form->processed_input);
             if ($this->save()) {
                 if ($form->ret) {
                     redirect($form->ret);
                 } else {
                     redirect('admin/' . $this->table_name);
                 }
             }
         } else {
             $messages->error('Input does not validate.');
             $this->setData($form->processed_input);
         }
     } elseif (isset($path[2]) && $path[2] == 'edit') {
         $this->loadById($path[3]);
         $page_title = t($form->entity_title) . ': ' . t('Editing');
     } elseif (isset($path[2]) && $path[2] == 'delete') {
         if ($this->deleteById($path[3])) {
             if ($form->ret) {
                 redirect($form->ret);
             } else {
                 redirect('admin/' . $this->table_name);
             }
         }
     } else {
         $page_title = t($form->entity_title) . ': ' . t('New');
     }
 }
开发者ID:lotcz,项目名称:zshop,代码行数:35,代码来源:base.m.php


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