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


PHP Floor函数代码示例

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


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

示例1: toSubmit

 function toSubmit($payment)
 {
     $merId = $this->getConf($payment['M_OrderId'], 'member_id');
     $ikey = $this->getConf($payment['M_OrderId'], 'PrivateKey');
     //$order->M_Language = "tchinese";
     $payment["M_Language"] = "tchinese";
     //
     //$order->M_Amount = Floor($order->M_Amount);
     //$verify = md5($ikey."|".$merId."|".$order->M_OrderId."|".$order->M_Amount."|".$this->getConf('SecondPrivateKey'));
     $payment["M_Amount"] = Floor($payment["M_Amount"]);
     $verify = md5($ikey . "|" . $merId . "|" . $payment["M_OrderId"] . "|" . $payment["M_Amount"] . "|" . $this->getConf($payment['M_OrderId'], 'SecondPrivateKey'));
     $return["mid"] = $merId;
     $return["ordernum"] = $payment["M_OrderId"];
     //$order->M_OrderId;
     $return["txid"] = $payment["M_OrderId"];
     //$order->M_OrderId;
     $return["iid"] = "0";
     $return["amount"] = $payment["M_Amount"];
     //$order->M_Amount;
     $return["cname"] = $payment["R_Name"];
     //$order->R_Name;
     $return["caddress"] = $payment["R_Address"];
     //$order->R_Address;
     $return["language"] = $payment["M_Language"];
     //$order->M_Language;
     $return["version"] = "1.0";
     $return["return_url"] = $this->callbackUrl;
     $return["verify"] = $verify;
     return $return;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:30,代码来源:pay.twv.php

示例2: event_getobject

/**
*   Get Same Object 
*/
function event_getobject($event, $cityid)
{
    global $db, $phpEx, $phpbb_root_path, $user;
    $message = '';
    //根据膜拜次数确定物品加成
    $getobject = $getobject + Floor($userdata['worship'] / 1000);
    $sql = 'SELECT event.*,object.name FROM ' . EVENT_PROBABILITY . ' AS event  
			LEFT ' . OBJECTS_TABLE . " AS object ON (event.object_id=object.object_id)\r\n\t\t\t\t\tWHERE event.event_id=" . $event . ' AND event.city_id=' . $cityid;
    $db->sql_query($sql);
    $get_rand = rand(1, 60000);
    $objectid = 0;
    while ($row = $db->sql_fetchrow($result)) {
        if ((int) $row[s_numerator] < $get_rand && (int) $row[e_numerator] > $get_rand) {
            $object_id = $row['object_id'];
        }
    }
    if ($objectid != 0) {
        //添加物品
        $sql = 'SELECT * FROM ' . USER_BAG . "  \r\n\t\t\t\t\t\tWHERE user_id=" . $user->data['user_id'] . ' AND objectid=' . $objectid;
        if ($db->sql_query($sql) && $db->sql_affectedrows()) {
            $sql = 'UPDATE ' . USER_BAG . ' SET  object_num=object_num+' . $getobject . " WHERE user_id=" . $user->data['user_id'] . ' AND objectid=' . $objectid;
        } else {
            $sql = 'INSERT INTO ' . USER_BAG . " (user_id,objectid,object_num,object_type)  VALUES ( " . $user->data['user_id'] . ',' . $objectid . ',' . $getobject . ',' . $sys_objects[$objectid]['objecttype'] . ')';
        }
        $db->sql_query($sql);
        $db->sql_freeresult($result);
        $message = sprintf('得到 %d 个' . $row['name'], $getobject);
    }
    return $message;
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:33,代码来源:function_event.php

示例3: JulianDayToGregorian

function JulianDayToGregorian($Julian)
{
    #---------------------------------------------------------------------------
    $Julian = $Julian - 1721119;
    $Calc1 = 4 * $Julian - 1;
    #---------------------------------------------------------------------------
    $Year = Floor($Calc1 / 146097);
    $Julian = Floor($Calc1 - 146097 * $Year);
    $Day = Floor($Julian / 4);
    $Calc2 = 4 * $Day + 3;
    #---------------------------------------------------------------------------
    $Julian = Floor($Calc2 / 1461);
    $Day = $Calc2 - 1461 * $Julian;
    $Day = Floor(($Day + 4) / 4);
    $Calc3 = 5 * $Day - 3;
    #---------------------------------------------------------------------------
    $Month = Floor($Calc3 / 153);
    $Day = $Calc3 - 153 * $Month;
    $Day = Floor(($Day + 5) / 5);
    $Year = 100 * $Year + $Julian;
    #---------------------------------------------------------------------------
    if ($Month < 10) {
        $Month = $Month + 3;
    } else {
        #-------------------------------------------------------------------------
        $Month = $Month - 9;
        $Year = $Year + 1;
    }
    #---------------------------------------------------------------------------
    return MkTime(0, 0, 0, $Month, $Day, $Year);
}
开发者ID:carriercomm,项目名称:jbs,代码行数:31,代码来源:Bpanel.comp.php

示例4: ApplyMask

function ApplyMask(&$image, $mask)
{
    // Create copy of mask as mask may not be the same size as image
    $mask_resized = ImageCreateTrueColor(ImageSX($image), ImageSY($image));
    ImageCopyResampled($mask_resized, $mask, 0, 0, 0, 0, ImageSX($image), ImageSY($image), ImageSX($mask), ImageSY($mask));
    // Create working temp
    $mask_blendtemp = ImageCreateTrueColor(ImageSX($image), ImageSY($image));
    $color_background = ImageColorAllocate($mask_blendtemp, 0, 0, 0);
    ImageFilledRectangle($mask_blendtemp, 0, 0, ImageSX($mask_blendtemp), ImageSY($mask_blendtemp), $color_background);
    // switch off single color alph and switch on full alpha channel
    ImageAlphaBlending($mask_blendtemp, false);
    ImageSaveAlpha($mask_blendtemp, true);
    // loop the entire image and set pixels, this will be slow for large images
    for ($x = 0; $x < ImageSX($image); $x++) {
        for ($y = 0; $y < ImageSY($image); $y++) {
            $RealPixel = GetPixelColor($image, $x, $y);
            $MaskPixel = GrayscalePixel(GetPixelColor($mask_resized, $x, $y));
            $MaskAlpha = 127 - Floor($MaskPixel['red'] / 2) * (1 - $RealPixel['alpha'] / 127);
            $newcolor = ImageColorAllocateAlpha($mask_blendtemp, $RealPixel['red'], $RealPixel['green'], $RealPixel['blue'], $MaskAlpha);
            ImageSetPixel($mask_blendtemp, $x, $y, $newcolor);
        }
    }
    // don't need the mask copy anymore
    ImageDestroy($mask_resized);
    // switch off single color alph and switch on full alpha channel
    ImageAlphaBlending($image, false);
    ImageSaveAlpha($image, true);
    // replace the image with the blended temp
    ImageCopy($image, $mask_blendtemp, 0, 0, 0, 0, ImageSX($mask_blendtemp), ImageSY($mask_blendtemp));
    ImageDestroy($mask_blendtemp);
}
开发者ID:vinorodrigues,项目名称:wpts-favicons,代码行数:31,代码来源:fakeapple.php

示例5: determineCoordsFromParameters

function determineCoordsFromParameters($caveData, $mapSize)
{
    // default Werte: Koordinaten of the given caveData (that is the data of the presently selected own cave)
    $xCoord = $caveData['xCoord'];
    $yCoord = $caveData['yCoord'];
    $message = '';
    // wenn in die Minimap geklickt wurde, zoome hinein
    if (($minimap_x = Request::getVar('minimap_x', 0)) && ($minimap_y = Request::getVar('minimap_y', 0)) && ($scaling = Request::getVar('scaling', 0)) !== 0) {
        $xCoord = Floor($minimap_x * 100 / $scaling) + $mapSize['minX'];
        $yCoord = Floor($minimap_y * 100 / $scaling) + $mapSize['minY'];
    } else {
        if ($caveName = Request::getVar('caveName', '')) {
            $coords = getCaveByName($caveName);
            if (!$coords['xCoord']) {
                $message = sprintf(_('Die Höhle mit dem Namen: "%s" konnte nicht gefunden werden!'), $caveName);
            } else {
                $xCoord = $coords['xCoord'];
                $yCoord = $coords['yCoord'];
                $message = sprintf(_('Die Höhle mit dem Namen: "%s" befindet sich in (%d|%d).'), $caveName, $xCoord, $yCoord);
            }
        } else {
            if (($targetCaveID = Request::getVar('targetCaveID', 0)) !== 0) {
                $coords = getCaveByID($targetCaveID);
                if ($coords === null) {
                    $message = sprintf(_('Die Höhle mit der ID: "%d" konnte nicht gefunden werden!'), $targetCaveID);
                } else {
                    $xCoord = $coords['xCoord'];
                    $yCoord = $coords['yCoord'];
                    $message = sprintf(_('Die Höhle mit der ID: "%d" befindet sich in (%d|%d).'), $targetCaveID, $xCoord, $yCoord);
                }
            } else {
                if (Request::getVar('xCoord', 0) && Request::getVar('yCoord', 0)) {
                    $xCoord = Request::getVar('xCoord', 0);
                    $yCoord = Request::getVar('yCoord', 0);
                }
            }
        }
    }
    // Koordinaten begrenzen
    if ($xCoord < $mapSize['minX']) {
        $xCoord = $mapSize['minX'];
    }
    if ($yCoord < $mapSize['minY']) {
        $yCoord = $mapSize['minY'];
    }
    if ($xCoord > $mapSize['maxX']) {
        $xCoord = $mapSize['maxX'];
    }
    if ($yCoord > $mapSize['maxY']) {
        $yCoord = $mapSize['maxY'];
    }
    return array('xCoord' => $xCoord, 'yCoord' => $yCoord, 'message' => $message);
}
开发者ID:norter,项目名称:Game,代码行数:53,代码来源:map.html.php

示例6: rvb2hexa

	function rvb2hexa($composante){
		$hexa=array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");

		$hex1=Floor($composante/16);
		$hex2=$composante-$hex1*16;
		$chaine=$hexa["$hex1"].$hexa["$hex2"];
		$fich=fopen("/tmp/svg.txt","a+");
		/*
		fwrite($fich,"Composante: $composante\n");
		fwrite($fich,"\$hex1: $hex1\n");
		fwrite($fich,"\$hex2: $hex2\n");
		fwrite($fich,"\$chaine: $chaine\n");
		*/
		return $chaine;
	}
开发者ID:rhertzog,项目名称:lcs,代码行数:15,代码来源:draw_graphe_svg.php

示例7: process

 protected function process(ViewBag $viewbag)
 {
     $thumbnailer = $this->movie->getThumbnailer();
     $viewbag->Thumbnailer = $thumbnailer;
     // List of defined cutpoints
     $max = $this->movie->getMaxSeek();
     $duration_sec = $this->movie->duration();
     $viewbag->CutList = array();
     foreach ($this->list->getCutRegions() as $v) {
         $left = $v[0];
         $right = $v[1];
         $duration_mark = ($right == -1 ? $max : $right) - $left;
         $secs = Floor(DoubleVal($duration_mark) / $max * $duration_sec);
         $c = new StdClass();
         $c->Timestamp = sprintf("%02d:%02d:%02d ", floor($secs / 3600), $secs % 3600 / 60, $secs % 60);
         $c->Left = $left;
         $c->Right = $right == -1 ? $max : $right;
         $viewbag->CutList[] = $c;
     }
     $this->SetView($this->ajax ? "MovieAjax" : "Movie");
 }
开发者ID:roadrunner6,项目名称:mythcut,代码行数:21,代码来源:MovieHandler.php

示例8: toSubmit

 function toSubmit($payment)
 {
     if ($this->getConf('system.shoplang') == "en_US") {
         $this->submitUrl = "https://gwpay.com.tw/form_Sc_to5e.php";
     } else {
         $this->submitUrl = "https://gwpay.com.tw/form_Sc_to5.php";
     }
     $merId = $this->getConf($payment["M_OrderId"], 'member_id');
     $ikey = $this->getConf($payment["M_OrderId"], 'PrivateKey');
     $payment["M_Amount"] = Floor($payment["M_Amount"]);
     //$order->M_Amount = Floor($order->M_Amount);
     $return['act'] = "auth";
     $return['client'] = $merId;
     $return['od_sob'] = $payment["M_OrderId"];
     //$order->M_OrderId;
     $return['amount'] = $payment["M_Amount"];
     //$order->M_Amount;
     $return['email'] = $payment["R_Email"];
     //$order->R_Email;
     $return['roturl'] = $this->callbackUrl;
     return $return;
 }
开发者ID:noikiy,项目名称:MyShop,代码行数:22,代码来源:pay.gwpay.php

示例9: ConvertMinutes2Hours

 public function ConvertMinutes2Hours($Minutes)
 {
     if ($Minutes < 0) {
         $Min = Abs($Minutes);
     } else {
         $Min = $Minutes;
     }
     $iHours = Floor($Min / 60);
     $Minutes = ($Min - $iHours * 60) / 100;
     $tHours = $iHours + $Minutes;
     if ($Minutes < 0) {
         $tHours = $tHours * -1;
     }
     $aHours = explode(".", $tHours);
     $iHours = $aHours[0];
     if (empty($aHours[1])) {
         $aHours[1] = "00";
     }
     $Minutes = $aHours[1];
     if (strlen($Minutes) < 2) {
         $Minutes = $Minutes . "0";
     }
     $tHours = $iHours . ":" . $Minutes;
     return $tHours;
 }
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:25,代码来源:kACARS_Free.php

示例10: GetWeaponDetails

     exit;
 }
 GetWeaponDetails("{$TactFactory['c_wep']}", 'CustWepS');
 if (isset($secureCustom)) {
     $secureCustom = 1;
     if ($ttlused_pt + $CustWepS['complexity'] * 10 > $TactFactory['c_point'] || $ttlused_pt <= 0) {
         echo "改造點數不足或出錯!";
         postFooter();
         exit;
     }
 } else {
     $secureCustom = 0;
 }
 $CustomedAtk = Floor($CustWepS['atk'] * $atkc_pt * 0.005);
 $CustomedHit = Floor($CustWepS['hit'] * $hitc_pt * 0.005);
 $CustomedRd = Floor($CustWepS['rd'] * $rdc_pt * 0.005);
 $CustomedENCc = $CustWepS['enc'] * (1 + $atkc_pt * 0.01) * (1 + $rdc_pt * 0.01) * (1 + $hitc_pt * 0.01);
 $CustomedENC = Ceil($CustomedENCc - $CustomedENCc * $encc_pt * 0.005);
 $fixedname = preg_replace('/([!@#$%^&*()[\\]\\{}\'",.\\/<>?|]|--)+/', '', $fixedname);
 if ($namefix > 2 || $namefix < 1) {
     echo "Cannot Get Fix Type";
     postFooter();
     exit;
 }
 unset($sql);
 if (strlen($fixedname) > 32) {
     echo "專用名稱過長!";
     postFooter();
     exit;
 }
 $costPt = $ttlused_pt;
开发者ID:c0re100,项目名称:PHP-Endless-Battle,代码行数:31,代码来源:tact_custom.php

示例11: milmillon

 function milmillon($nummierod)
 {
     if ($nummierod >= 1000000000 && $nummierod < 2000000000) {
         $num_letrammd = "MIL " . cienmillon($nummierod % 1000000000);
     }
     if ($nummierod >= 2000000000 && $nummierod < 10000000000) {
         $num_letrammd = unidad(Floor($nummierod / 1000000000)) . " MIL " . cienmillon($nummierod % 1000000000);
     }
     if ($nummierod < 1000000000) {
         $num_letrammd = cienmillon($nummierod);
     }
     return $num_letrammd;
 }
开发者ID:Emagenic-ltda,项目名称:pcplay,代码行数:13,代码来源:postventa3.php

示例12: obliczpunkty

 /**
  * Dodaje punkty za szybkosć 
  * @param type $szybkoscg
  * @param type $szybkoscp
  * @return type
  */
 public function obliczpunkty($szybkoscg, $szybkoscp)
 {
     $punkty = Floor($szybkoscg / $szybkoscp);
     --$punkty;
     return $punkty;
 }
开发者ID:Andrzej100,项目名称:dom,代码行数:12,代码来源:Tura.php

示例13: lignes

					
					//echo "\$lig_param->nom=$lig_param->nom<br />";
					//echo "\$lig_param->valeur=$lig_param->valeur";
					$nom=$lig_param->nom;
					$$nom=$lig_param->valeur;
					
					//if($lig_param->nom=='trombino_pdf_nb_lig') {$trombino_pdf_nb_lig=$lig_param->value;}
					//elseif($lig_param->nom=='trombino_pdf_nb_col') {$trombino_pdf_nb_col=$lig_param->value;}
				}

				// Nombre de cases par page
				$nb_cell=$trombino_pdf_nb_lig*$trombino_pdf_nb_col;
				// Hauteur d'un cadre
				$haut_cadre=Floor($hauteur_page-$MargeHaut-$MargeBas-$hauteur_classe-$ecart_sous_classe-($trombino_pdf_nb_lig-1)*$dy)/$trombino_pdf_nb_lig;
				// Largeur d'un cadre
				$larg_cadre=Floor($largeur_page-$MargeDroite-$MargeGauche-($trombino_pdf_nb_col-1)*$dx)/$trombino_pdf_nb_col;

				/*
				$msg.="\$trombino_pdf_nb_lig=$trombino_pdf_nb_lig<br />";
				$msg.="\$trombino_pdf_nb_col=$trombino_pdf_nb_col<br />";
				$msg.="\$nb_cell=$nb_cell<br />";
				$msg.="\$haut_cadre=$haut_cadre<br />";
				$msg.="\$larg_cadre=$larg_cadre<br />";
				*/

				$msg.="Traitement des découpes avec une grille de $trombino_pdf_nb_col colonnes sur $trombino_pdf_nb_lig lignes (id_grille n°$id_grille).<br />";

				if (isset($GLOBALS['multisite']) AND $GLOBALS['multisite'] == 'y') {
					// On récupère le RNE de l'établissement
					$repertoire2=$_COOKIE['RNE']."/";
				}
开发者ID:rhertzog,项目名称:lcs,代码行数:30,代码来源:trombino_decoupe.php

示例14: mysql_query

     $sql = "UPDATE `" . $GLOBALS['DBPrefix'] . "phpeb_user_general_info` SET `cash` = '{$GenVal['cash']}',\r\n`msuit` = {$GenVal['msuit']} WHERE `username` = '{$Pl_Value['USERNAME']}' LIMIT 1;";
     mysql_query($sql);
     echo "<form action=gmscrn_main.php?action=proc method=post name=frmreturn target=Alpha>";
     echo "<p align=center style=\"font-size: 16pt\">购买完成了!<br><input type=submit value=\"返回\" onClick=\"parent.Beta.location.replace('gen_info.php')\"></p>";
 } elseif ($actionc == 'sell') {
     GetMsDetails("{$GenVal['msuit']}", 'NowMS');
     $Pl_WepD = explode('<!>', $GameVal['eqwep']);
     GetWeaponDetails("{$Pl_WepD['0']}", 'Pl_SyWepD');
     $Pl_WepE = explode('<!>', $GameVal['p_equip']);
     GetWeaponDetails("{$Pl_WepE['0']}", 'Pl_SyWepE');
     if (!$GenVal['msuit']) {
         echo "你没有机体!!<br>";
         PostFooter();
         exit;
     }
     $SellPrice = Floor($NowMS['price'] / 2 + $NowMS['price'] * 0.2);
     $GenVal['cash'] = $GenVal['cash'] + $SellPrice;
     $GameVal['hpmax'] = $GameVal['hpmax'] - $NowMS['hpfix'];
     $GameVal['enmax'] = $GameVal['enmax'] - $NowMS['enfix'];
     $GenVal['msuit'] = '0';
     $HP_Sub = $EN_Sub = 0;
     if (ereg('(ExtHP)+', $Pl_SyWepE['spec'])) {
         $a = ereg_replace('.*ExtHP<', '', $Pl_SyWepE['spec']);
         $HP_Sub = intval($a);
     }
     if (ereg('(ExtEN)+', $Pl_SyWepE['spec'])) {
         $a = ereg_replace('.*ExtEN<', '', $Pl_SyWepE['spec']);
         $EN_Sub = intval($a);
     }
     $GameVal['hpmax'] -= $HP_Sub;
     $GameVal['enmax'] -= $EN_Sub;
开发者ID:Saren-Arterius,项目名称:php-eb,代码行数:31,代码来源:equip.php

示例15: bcmul

 function bcmul($Num1 = '0', $Num2 = '0')
 {
     // check if they're both plain numbers
     if (!preg_match("/^\\d+\$/", $Num1) || !preg_match("/^\\d+\$/", $Num2)) {
         return 0;
     }
     // remove zeroes from beginning of numbers
     for ($i = 0; $i < strlen($Num1); $i++) {
         if (@$Num1[$i] != '0') {
             $Num1 = substr($Num1, $i);
             break;
         }
     }
     for ($i = 0; $i < strlen($Num2); $i++) {
         if (@$Num2[$i] != '0') {
             $Num2 = substr($Num2, $i);
             break;
         }
     }
     // get both number lengths
     $Len1 = strlen($Num1);
     $Len2 = strlen($Num2);
     // $Rema is for storing the calculated numbers and $Rema2 is for carrying the remainders
     $Rema = $Rema2 = array();
     // we start by making a $Len1 by $Len2 table (array)
     for ($y = $i = 0; $y < $Len1; $y++) {
         for ($x = 0; $x < $Len2; $x++) {
             // we use the classic lattice method for calculating the multiplication..
             // this will multiply each number in $Num1 with each number in $Num2 and store it accordingly
             @($Rema[$i++ % $Len2] .= sprintf('%02d', (int) $Num1[$y] * (int) $Num2[$x]));
         }
     }
     // cycle through each stored number
     for ($y = 0; $y < $Len2; $y++) {
         for ($x = 0; $x < $Len1 * 2; $x++) {
             // add up the numbers in the diagonal fashion the lattice method uses
             @($Rema2[Floor(($x - 1) / 2) + 1 + $y] += (int) $Rema[$y][$x]);
         }
     }
     // reverse the results around
     $Rema2 = array_reverse($Rema2);
     // cycle through all the results again
     for ($i = 0; $i < count($Rema2); $i++) {
         // reverse this item, split, keep the first digit, spread the other digits down the array
         $Rema3 = str_split(strrev($Rema2[$i]));
         for ($o = 0; $o < count($Rema3); $o++) {
             if ($o == 0) {
                 @($Rema2[$i + $o] = $Rema3[$o]);
             } else {
                 @($Rema2[$i + $o] += $Rema3[$o]);
             }
         }
     }
     // implode $Rema2 so it's a string and reverse it, this is the result!
     $Rema2 = strrev(implode($Rema2));
     // just to make sure, we delete the zeros from the beginning of the result and return
     while (strlen($Rema2) > 1 && $Rema2[0] == '0') {
         $Rema2 = substr($Rema2, 1);
     }
     return $Rema2;
 }
开发者ID:olragon,项目名称:iptools,代码行数:61,代码来源:polyfill.php


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