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


PHP is_double函数代码示例

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


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

示例1: fromUpperDecimal

 /**
  * Creates new Tax from a upper decimal value.
  * I.e. value must be '1.22' for a tax of '22%'.
  *
  * @param double $lowerDecimal
  * @return Tax
  * @throws InvalidArgumentException
  */
 public static function fromUpperDecimal($upperDecimal)
 {
     if (!is_double($upperDecimal)) {
         throw new InvalidArgumentException('$upperDecimal must be a double, but ' . $upperDecimal . ' given.');
     }
     return new TaxImpl($upperDecimal);
 }
开发者ID:o5,项目名称:eciovni,代码行数:15,代码来源:TaxImpl.php

示例2: testGetPaymentTypes

 public function testGetPaymentTypes()
 {
     $cougarCashClient = new \clients\cougar_cash();
     $result = $cougarCashClient->getPaymentTypes();
     if (count($result->{"payment_types"}) > 0) {
         foreach ($result->{"payment_types"} as $paymentType) {
             if ($paymentType->{"account_type"} == "CREDIT_CARD") {
                 $this->assertTrue(is_string($paymentType->{"id"}));
                 $this->assertTrue(is_string($paymentType->{"nickname"}));
                 $this->assertTrue(is_string($paymentType->{"munged_account_num"}));
                 $this->assertTrue(substr($paymentType->{"munged_account_num"}, 0, 1) === "*");
                 $this->assertTrue(is_string($paymentType->{"financial_institution"}));
                 $this->assertTrue(is_int($paymentType->{"minimum"}));
                 $this->assertTrue(is_int($paymentType->{"maximum"}));
                 $this->assertTrue(is_double($paymentType->{"min_fee"}));
                 $this->assertTrue(is_double($paymentType->{"fee_percent"}));
             } elseif ($paymentType->{"account_type"} == "BANK_ACCOUNT") {
                 $this->assertTrue(is_string($paymentType->{"id"}));
                 $this->assertTrue(is_string($paymentType->{"nickname"}));
                 $this->assertTrue(is_string($paymentType->{"munged_account_num"}));
                 $this->assertTrue(substr($paymentType->{"munged_account_num"}, 0, 1) === "*");
                 $this->assertTrue(is_string($paymentType->{"financial_institution"}));
                 $this->assertTrue(is_int($paymentType->{"minimum"}));
                 $this->assertTrue(is_int($paymentType->{"maximum"}));
             }
         }
     }
 }
开发者ID:byu-oit-appdev,项目名称:cougarCashPhpClientTests,代码行数:28,代码来源:cougar_cashTest.php

示例3: testCanSearchAddress

 public function testCanSearchAddress()
 {
     $latAndLong = $this->geocoder->getGeocodedLatitudeAndLongitude('12 Girouard, Montreal, Quebec');
     $this->assertTrue(is_array($latAndLong));
     $this->assertTrue(is_double($latAndLong[0]));
     $this->assertTrue(is_double($latAndLong[1]));
 }
开发者ID:tests1,项目名称:zendcasts,代码行数:7,代码来源:GeocodingAdapterTest.php

示例4: recursiveQuote

 protected function recursiveQuote($val)
 {
     if (is_array($val)) {
         $return = array();
         foreach ($val as $v) {
             $return[] = $this->recursiveQuote($v);
         }
         return '(' . implode(',', $return) . ')';
     } else {
         if (is_null($val)) {
             $val = 'NULL';
         } else {
             if (is_int($val)) {
                 $val = (int) $val;
             } else {
                 if (is_double($val)) {
                     $val = (double) $val;
                 } else {
                     if (is_float($val)) {
                         $val = (double) $val;
                     } else {
                         $val = "'" . Convert::raw2sql($val) . "'";
                     }
                 }
             }
         }
     }
     return $val;
 }
开发者ID:nyeholt,项目名称:silverstripe-external-content,代码行数:29,代码来源:ECUtils.php

示例5: prepare

 /**
  * @param $sql
  * @param $params
  * @return mixed
  */
 private function prepare($sql, $params)
 {
     $escaped = '';
     if ($params) {
         foreach ($params as $key => $value) {
             if (is_bool($value)) {
                 $value = $value ? 1 : 0;
             } elseif (is_double($value)) {
                 $value = str_replace(',', '.', $value);
             } elseif (is_numeric($value)) {
                 if (is_string($value)) {
                     $value = "'" . $this->provider->escape($value) . "'";
                 } else {
                     $value = $this->provider->escape($value);
                 }
             } elseif (is_null($value)) {
                 $value = "NULL";
             } else {
                 $value = "'" . $this->provider->escape($value) . "'";
             }
             $escaped[] = $value;
         }
     }
     $this->params = $escaped;
     $q = preg_replace_callback("/(\\?)/i", array($this, "replaceParams"), $sql);
     return $q;
 }
开发者ID:elephantphp,项目名称:ElephantFreamwork,代码行数:32,代码来源:Database.php

示例6: isHourValid

 public function isHourValid($hour)
 {
     if (!is_numeric($hour) || is_double($hour) || $hour < 0) {
         return false;
     }
     return true;
 }
开发者ID:b4t3ou,项目名称:due_date_calculator,代码行数:7,代码来源:Validator.php

示例7: where

 public function where($where, $val = null)
 {
     $where = $this->escape($where);
     if ($val === true) {
         $this->where_list[] = $where . " = 'TRUE'";
     } else {
         if ($val === false) {
             $this->where_list[] = $where . " = 'FALSE'";
         } else {
             if ($val === null) {
                 $this->where_list[] = $where;
             } else {
                 if (is_string($val)) {
                     $this->where_list[] = $where . " = '" . $this->escape($val) . "'";
                 } else {
                     if (is_int($val) || is_float($val) || is_double($val)) {
                         $this->where_list[] = $where . ' = ' . $this->escape($val);
                     } else {
                         $this->where_list[] = $where . " = '" . $this->escape($val) . "'";
                         # default
                     }
                 }
             }
         }
     }
 }
开发者ID:ThisNameWasFree,项目名称:rude-univ,代码行数:26,代码来源:rude-iquery.php

示例8: testCGet

 public function testCGet()
 {
     $client = static::createClient();
     $crawler = $client->request('GET', '/api/charges');
     $this->assertTrue($client->getResponse()->headers->contains('Content-Type', 'application/json'));
     $json = json_decode($client->getResponse()->getContent());
     $this->assertNotNull($json, $client->getResponse()->getContent());
     $this->assertEquals($json->{'error'}, "success");
     $this->assertInternalType("array", $json->{'charges'});
     foreach ($json->{'charges'} as $charge) {
         $this->assertInternalType("integer", $charge->{'id'});
         if (property_exists($charge, 'description')) {
             $this->assertInternalType("string", $charge->{'description'});
         }
         if (is_double($charge->{'duration'})) {
             $this->assertInternalType("float", $charge->{'duration'});
         } else {
             $this->assertInternalType("integer", $charge->{'duration'});
         }
         $this->assertInternalType("string", $charge->{'created'});
         $this->assertInternalType("object", $charge->{'employee'});
         $this->assertInternalType("object", $charge->{'task'});
         $this->assertFalse(date_create($charge->{'created'}) === FALSE);
     }
     $client->insulate();
 }
开发者ID:pscheyer,项目名称:PlanITJavascript,代码行数:26,代码来源:ChargeControllerTest.php

示例9: __construct

 /**
  * @param double $value
  * @throws Exception
  */
 public function __construct($value)
 {
     if (!is_double($value)) {
         throw new Exception('Incoming value must be of type double.');
     }
     $this->_value = $value;
 }
开发者ID:jippi,项目名称:php-cassandra,代码行数:11,代码来源:Double.php

示例10: assertEquals

 /**
  * Asserts that two variables are equal.
  *
  * @param  mixed  $expected
  * @param  mixed  $actual
  * @param  mixed  $delta
  * @param  string $message
  * @access public
  * @static
  */
 public static function assertEquals($expected, $actual, $delta = 0, $message = '')
 {
     if (is_null($expected) && is_null($actual)) {
         return;
     }
     if (is_object($expected)) {
         if (!is_object($actual) || serialize($expected) != serialize($actual)) {
             self::failNotEquals($expected, $actual, $message);
         }
         return;
     }
     if (is_array($expected)) {
         if (!is_array($actual)) {
             self::failNotEquals($expected, $actual, $message);
         }
         self::sortArrayRecursively($actual);
         self::sortArrayRecursively($expected);
         if (self::$looselyTyped) {
             $actual = self::convertToString($actual);
             $expected = self::convertToString($expected);
         }
         self::assertEquals(serialize($expected), serialize($actual));
         return;
     }
     if ((is_double($expected) || is_float($expected)) && (is_double($actual) || is_float($actual))) {
         if (!(abs($expected - $actual) <= $delta)) {
             self::failNotEquals($expected, $actual, $message);
         }
         return;
     }
     if (self::$looselyTyped) {
         settype($actual, gettype($expected));
     }
     self::assertSame($expected, $actual, $message);
 }
开发者ID:nateirwin,项目名称:custom-historic,代码行数:45,代码来源:Assert.php

示例11: add

 /**
  * This method adds the passed object with the passed key
  * to the HashMap.
  *
  * @param mixed $key    The key to add the passed value under
  * @param mixed $object The object to add to the HashMap
  *
  * @return \AppserverIo\Collections\HashMap The instance
  * @throws \AppserverIo\Collections\InvalidKeyException Is thrown if the passed key is NOT an primitive datatype
  * @throws \AppserverIo\Lang\NullPointerException Is thrown if the passed key is null or not a flat datatype like Integer, Strng, Double or Boolean
  */
 public function add($key, $object)
 {
     if (is_null($key)) {
         throw new NullPointerException('Passed key is null');
     }
     // check if a primitive datatype is passed
     if (is_integer($key) || is_string($key) || is_double($key) || is_bool($key)) {
         // add the item to the array
         $this->items[$key] = $object;
         // and return
         return;
     }
     // check if an object is passed
     if (is_object($key)) {
         if ($key instanceof Strng) {
             $newKey = $key->stringValue();
         } elseif ($key instanceof Flt) {
             $newKey = $key->floatValue();
         } elseif ($key instanceof Integer) {
             $newKey = $key->intValue();
         } elseif ($key instanceof Boolean) {
             $newKey = $key->booleanValue();
         } elseif (method_exists($key, '__toString')) {
             $newKey = $key->__toString();
         } else {
             throw new InvalidKeyException('Passed key has to be a primitive datatype or  has to implement the __toString() method');
         }
         // add the item to the array
         $this->items[$newKey] = $object;
         // and return
         return;
     }
     throw new InvalidKeyException('Passed key has to be a primitive datatype or  has to implement the __toString() method');
 }
开发者ID:appserver-io,项目名称:collections,代码行数:45,代码来源:HashMap.php

示例12: unary

 public function unary($la)
 {
     for ($i = 0; $i < 3; $i++) {
         foreach ($la as $l) {
             if (is_int($l)) {
                 echo "{$l} is_int\n";
             }
             if (is_string($l)) {
                 echo "{$l} is_string\n";
             }
             if (is_double($l)) {
                 echo "{$l} is_double\n";
             }
             if (is_null($l)) {
                 echo "{$l} is_null\n";
             }
             if (is_double($l)) {
                 echo "{$l} is_double\n";
             }
             if (is_array($l)) {
                 echo "{$l} is_array\n";
             }
             if (is_object($l)) {
                 echo "{$l} is_object\n";
             }
         }
     }
 }
开发者ID:badlamer,项目名称:hhvm,代码行数:28,代码来源:allbranches.php

示例13: AddParameter

 private function AddParameter(&$params, &$types, $this_param)
 {
     if (is_array($this_param) === true && count($this_param) > 0) {
         // recurse into any number of nested arrays as necessary
         foreach ($this_param as $this_parameter) {
             self::AddParameter($params, $types, $this_parameter);
         }
     } else {
         if (is_string($this_param)) {
             $types[] = 's';
         } else {
             if (is_int($this_param)) {
                 $types[] = 'i';
             } else {
                 if (is_double($this_param)) {
                     $types[] = 'd';
                 } else {
                     $types[] = 's';
                     // string as default
                 }
             }
         }
         $params[] = $this_param;
     }
 }
开发者ID:jarek,项目名称:take-the-grt,代码行数:25,代码来源:Database.php

示例14: query

 public function query($query, $parameters = NULL)
 {
     $this->open_connection();
     $statement = $this->conn->prepare($query);
     if ($statement) {
         if (!is_null($parameters) && count($parameters) > 0) {
             foreach ($parameters as $parameter) {
                 if (is_integer($parameter)) {
                     $statement->bind_param("i", $parameter);
                 } elseif (is_double($parameter)) {
                     $statement->bind_param("d", $parameter);
                 } elseif (is_string($parameter)) {
                     $statement->bind_param("s", $parameter);
                 }
             }
         }
         $statement->execute();
         $result = $statement->get_result();
         $statement->close();
     } else {
         $log->error("Error preparing statement of query " . $query);
     }
     $this->close_connection();
     return $result;
 }
开发者ID:juanpmd,项目名称:Seek-Inspire,代码行数:25,代码来源:DB.php

示例15: _xmlType

 protected function _xmlType($value)
 {
     if (is_string($value)) {
         return "<string>{$value}</string>";
     } else {
         if (is_int($value)) {
             return "<int>{$value}</int>";
         } else {
             if (is_double($value)) {
                 return "<double>{$value}</double>";
             } else {
                 if (is_array($value) && count($value) > 0) {
                     $r = "<struct>\n";
                     foreach ($value as $n => $v) {
                         $r .= "\t<member>\n";
                         $r .= "\t\t<name>{$n}</name>\n";
                         $r .= "\t\t<value>{$this->_xmlType($v)}</value>\n";
                         $r .= "\t</member>\n";
                     }
                     return "{$r}\n</struct>\n";
                 }
             }
         }
     }
     return "<string><![[{$value}]]></string>";
 }
开发者ID:andelux,项目名称:landingpages,代码行数:26,代码来源:Wordpress.php


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