本文整理汇总了PHP中is_long函数的典型用法代码示例。如果您正苦于以下问题:PHP is_long函数的具体用法?PHP is_long怎么用?PHP is_long使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_long函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getValueInfo
/**
* return stacktrace-like information about the given variable
*
* @return string
*/
function getValueInfo($val)
{
if (is_null($val)) {
return 'null';
}
if (is_array($val)) {
return 'array[' . count($val) . ']';
}
if (is_bool($val)) {
return $val ? 'true' : 'false';
}
if (is_float($val) || is_int($val) || is_long($val) || is_real($val)) {
return 'num:' . $val;
}
if (is_string($val)) {
return 'string[' . strlen($val) . ']=' . substr($val, 0, 16);
}
if (is_resource($val)) {
return 'resource' . get_resource_type($val);
}
if (is_object($val)) {
return 'object';
}
return '?';
}
开发者ID:emente,项目名称:kataii---kata-framework-2.x,代码行数:30,代码来源:katafunctions.php
示例2: __construct
/**
* The constructor for the exception that sets up the exception and the Error class.
*
* @access public
* @param string $message The error message or the key matching a registered error
* @param mixed $params The error params or the error code
*/
public function __construct($message, $params = 0)
{
$code = null;
if (!is_array($params) && $params != 0) {
$params = array('code' => $params);
}
// call hook
Hook::call('Exeception.construct', array(&$message, &$params));
if ($error = Config::getError($message)) {
if (isset($error['messageArgs']) && isset($params['messageArgs'])) {
$params['messageArgs'] = array_merge($error['messageArgs'], $params['messageArgs']);
}
$params = array_merge($error, (array) $params);
$message = $params['message'];
if (isset($params['code'])) {
$code = $params['code'];
}
}
if (isset($params['messageArgs']) && is_array($params['messageArgs'])) {
$message = $this->dsprintf($message, $params['messageArgs']);
}
$this->params = (array) $params;
parent::__construct($message, is_long($code) ? $code : null);
Error::setupError($this);
}
开发者ID:kidaa30,项目名称:Evergreen-1,代码行数:32,代码来源:evergreen.exception.class.php
示例3: getChecksum
public function getChecksum($ccnum)
{
$len = strlen($ccnum);
if (!is_long($len / 2)) {
$weight = 2;
$digit = $ccnum[0];
} elseif (is_long($len / 2)) {
$weight = 1;
$digit = $ccnum[0] * 2;
}
if ($digit > 9) {
$digit = $digit - 9;
}
$i = 1;
$checksum = $digit;
while ($i < $len) {
if ($ccnum[$i] != ' ') {
$digit = $ccnum[$i] * $weight;
$weight = $weight == 1 ? 2 : 1;
if ($digit > 9) {
$digit = $digit - 9;
}
$checksum += $digit;
}
$i++;
}
return $checksum;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:28,代码来源:CreditCard.php
示例4: __construct
public function __construct($key)
{
if (!is_long($key)) {
E("传入了非法的信号量key");
}
$this->ipc_signal = sem_get($key);
}
开发者ID:yangjian102621,项目名称:herosphp,代码行数:7,代码来源:SemSynLock.class.php
示例5: _runPHP
private function _runPHP()
{
$this->_source = "return " . $this->_source . ";";
if (function_exists("token_get_all")) {
//tokenizer extension may be disabled
$php = "<?php\n" . $this->_source . "\n?>";
$tokens = token_get_all($php);
foreach ($tokens as $token) {
$type = $token[0];
if (is_long($type)) {
if (in_array($type, array(T_OPEN_TAG, T_RETURN, T_WHITESPACE, T_ARRAY, T_LNUMBER, T_DNUMBER, T_CONSTANT_ENCAPSED_STRING, T_DOUBLE_ARROW, T_CLOSE_TAG, T_NEW))) {
continue;
}
if ($type == T_STRING) {
$func = strtolower($token[1]);
if (in_array($func, array("mongoid", "mongocode", "mongodate", "mongoregex", "mongobindata", "mongoint32", "mongoint64", "mongodbref", "mongominkey", "mongomaxkey", "mongotimestamp", "true", "false", "null"))) {
continue;
}
}
exit("For your security, we stoped data parsing at '(" . token_name($type) . ") " . $token[1] . "'.");
}
}
}
return eval($this->_source);
}
开发者ID:jango2015,项目名称:nette-mongodb-sandbox,代码行数:25,代码来源:VarEval.php
示例6: __construct
/**
* CrsDate::__construct()
*
* @param mixed $date
* @return
*/
function __construct($date)
{
if (is_integer($date) || is_long($date)) {
$this->p_date = $date;
$this->DecomposeDate();
} elseif (is_object($date)) {
$this->Copy($date);
} else {
$time = "";
$pos = strpos($date, " ");
if ($pos) {
$time = substr($date, $pos + 1, strlen($date) - $pos - 1);
}
if (strpos($date, "-")) {
$this->p_year = substr($date, 0, 4) + 0;
$this->p_month = substr($date, 5, 2) + 0;
$this->p_day = substr($date, 8, 2) + 0;
} else {
$this->p_year = substr($date, 6, 4) + 0;
$this->p_month = substr($date, 0, 2) + 0;
$this->p_day = substr($date, 3, 2) + 0;
}
if ($time) {
$this->p_hour = substr($time, 0, 2) + 0;
$this->p_minute = substr($time, 3, 2) + 0;
$this->p_second = substr($time, 6, 2) + 0;
} else {
$this->p_hour = 0;
$this->p_minute = 0;
$this->p_second = 0;
}
$this->p_date = mktime($this->p_hour, $this->p_minute, $this->p_second, $this->p_month, $this->p_day, $this->p_year);
}
}
开发者ID:kelen303,项目名称:iEMS,代码行数:40,代码来源:CRSDate.php
示例7: setISBN
public function setISBN($isbn)
{
if (!is_long($isbn)) {
throw new InvalidArgumentException('"' . $isbn . '" is not a valid long.');
}
$this->isbn = $isbn;
}
开发者ID:rocksolid-tn,项目名称:pibx,代码行数:7,代码来源:BookType_TypeChecked.php
示例8: _translate
function _translate($tokens)
{
$this->tokens = $tokens;
$this->idx_current_token = 0;
$this->in_quoted_string = false;
$this->curnode->addChild('attrs');
$this->begin_statement_list();
for ($this->idx_current_token = 0; $this->idx_current_token < count($this->tokens); $this->idx_current_token++) {
$token = $this->tokens[$this->idx_current_token];
if (is_array($token)) {
$token_name = token_name($token[0]);
$token_value = $token[1];
} else {
if (is_long($token)) {
$token_name = token_name($token);
} else {
$token_name = $token;
$token_value = $token;
}
}
$method_name = strtolower($token_name);
if (strlen($method_name) == 1) {
$this->handle_char($method_name);
} else {
if (method_exists($this, $method_name)) {
$token[2] = token_name($token[0]);
$this->{$method_name}($token);
} else {
$this->jsbuf .= $token_value;
}
}
}
}
开发者ID:rex786,项目名称:php2js,代码行数:33,代码来源:phpxml.php
示例9: index
/**
* Extract data from a PDF document and add this to the Lucene index.
*
* @param string $pdfPath The path to the PDF document.
* @param Zend_Search_Lucene_Proxy $luceneIndex The Lucene index object.
* @return Zend_Search_Lucene_Proxy
*/
public static function index($pdfPath, $luceneIndex)
{
// Load the PDF document.
$pdf = Zend_Pdf::load($pdfPath);
$key = md5($pdfPath);
/**
* Set up array to contain the document index data.
* The Filename will be used to retrive the document if it is found in
* the search resutls.
* The Key will be used to uniquely identify the document so we can
* delete it from the search index.
*/
$indexValues = array('Filename' => $pdfPath, 'Key' => $key, 'Title' => '', 'Author' => '', 'Subject' => '', 'Keywords' => '', 'Creator' => '', 'Producer' => '', 'CreationDate' => '', 'ModDate' => '', 'Contents' => '');
// Go through each meta data item and add to index array.
foreach ($pdf->properties as $meta => $metaValue) {
switch ($meta) {
case 'Title':
$indexValues['Title'] = $pdf->properties['Title'];
break;
case 'Subject':
$indexValues['Subject'] = $pdf->properties['Subject'];
break;
case 'Author':
$indexValues['Author'] = $pdf->properties['Author'];
break;
case 'Keywords':
$indexValues['Keywords'] = $pdf->properties['Keywords'];
break;
case 'CreationDate':
$dateCreated = $pdf->properties['CreationDate'];
$distance = substr($dateCreated, 16, 2);
if (!is_long($distance)) {
$distance = null;
}
// Convert date from the PDF format of D:20090731160351+01'00'
$dateCreated = mktime(substr($dateCreated, 10, 2), substr($dateCreated, 12, 2), substr($dateCreated, 14, 2), substr($dateCreated, 6, 2), substr($dateCreated, 8, 2), substr($dateCreated, 2, 4), $distance);
//distance
$indexValues['CreationDate'] = date('Ymd', $dateCreated);
break;
case 'Date':
$indexValues['Date'] = $pdf->properties['Date'];
break;
}
}
/**
* Parse the contents of the PDF document and pass the text to the
* contents item in the $indexValues array.
*/
$pdfParse = new App_Search_Helper_PdfParser();
$indexValues['Contents'] = $pdfParse->pdf2txt($pdf->render());
// Create the document using the values
$doc = new App_Search_Lucene_Document($indexValues);
if ($doc !== false) {
// If the document creation was sucessful then add it to our index.
$luceneIndex->addDocument($doc);
}
// Return the Lucene index object.
return $luceneIndex;
}
开发者ID:philipnorton42,项目名称:PDFSearch,代码行数:66,代码来源:Pdfs.php
示例10: getDateTimeFromClaim
/**
* @param Claim\Expiration $expirationClaim
* @throws \InvalidArgumentException
* @return \DateTime
*/
private function getDateTimeFromClaim(Claim\Expiration $expirationClaim)
{
if (!is_long($expirationClaim->getValue())) {
throw new \InvalidArgumentException(sprintf('Invalid expiration timestamp "%s"', $expirationClaim->getValue()));
}
$expiration = new \DateTime();
$expiration->setTimestamp($expirationClaim->getValue());
return $expiration;
}
开发者ID:emarref,项目名称:jwt,代码行数:14,代码来源:ExpirationVerifier.php
示例11: comprobar_nif
function comprobar_nif($nif)
{
$letras = explode(',', 'T,R,W,A,G,M,Y,F,P,D,X,B,N,J,Z,S,Q,V,H,L,C,K,E');
if (strlen($nif) != 9 || !is_long($entero = intval(substr($nif, 0, 8))) || !in_array($letra = strtoupper(substr($nif, 8, 1)), $letras) || $letra != $letras[$entero % 23]) {
return false;
} else {
return true;
}
}
开发者ID:jhderojasUVa,项目名称:ipa,代码行数:9,代码来源:dni.php
示例12: set
/**
* Sets an IP
*
* @param string $ip
*/
public function set($ip)
{
if (is_long($ip)) {
$ip = long2ip($ip);
}
Assertion::ip($ip);
$this->callMethod('setip', compact('ip'));
return true;
}
开发者ID:fatalaa,项目名称:seeme,代码行数:14,代码来源:Ip.php
示例13: attach
/**
* @param $key
* @param $size
* @throws InvalidArgumentException
* @return array
*/
protected function attach($key, $size)
{
if (!array_key_exists($key, $this->values)) {
if (!is_long($key)) {
throw new InvalidArgumentException(sprintf('Expected type long for "key" but "%s" given.', gettype($key)));
}
$this->values[$key] = array('shm' => shm_attach($key, $size), 'mutex' => sem_get($key, 1));
}
return $this->values[$key];
}
开发者ID:bes89,项目名称:sharedmemory,代码行数:16,代码来源:SharedMemory.php
示例14: withSecure
/**
* Creates a money instance using a complete
* integer value for both the whole part
* and the fractional part
*
* @param $amount
* @param Currency|null $currency
*
* @return Money
* @throws InvalidAmountException
*/
public static function withSecure($amount, Currency $currency = null)
{
if (!is_long($amount)) {
throw new InvalidAmountException();
}
$money = self::withRaw(0, $currency);
$money->setFraction($amount / 100);
$money->setWhole($amount / 100);
return $money;
}
开发者ID:brightantwiboasiako,项目名称:money,代码行数:21,代码来源:Money.php
示例15: setOption
/**
* Setter for curl pre-request settings.
* @param array/int $option
* @param mixed $value
*/
public function setOption($option, $value = null)
{
if (!is_array($option)) {
$option = is_long($option) ? $option : constant($option);
curl_setopt($this->res, $option, $value);
} else {
foreach ($option as $key => $opt) {
$this->setOption($key, $opt);
}
}
}
开发者ID:ionutmilica,项目名称:my-archive,代码行数:16,代码来源:cURL.php
示例16: checkErrors
private function checkErrors()
{
if ($this->code) {
$errors = array_merge($this->_generalErrors, $this->errors);
if (array_key_exists($this->code, $errors)) {
$message = $this->error ? $this->error : $errors[$this->code];
throw new \Exception($message, is_long($this->code) ? $this->code : 0);
}
}
return $this;
}
开发者ID:hmphu,项目名称:payoneer,代码行数:11,代码来源:ResponseAbstract.php
示例17: isExpired
/**
* @param int $timeout_min
* @return bool
*/
public function isExpired($timeout_min)
{
if (!is_long($this->startTime) || !$this->isState(SurveyExecutionState::InProgress())) {
return true;
}
$diff = time() - $this->startTime;
if ($diff > $timeout_min) {
return true;
}
return false;
}
开发者ID:sarhanm,项目名称:sms-survey,代码行数:15,代码来源:SurveyState.php
示例18: __construct
function __construct($message = null, $code = 0, $file = null, $line = -1, $context = array(), Exception $previous = null)
{
if (is_array($message)) {
$message = array_shift($message);
}
if (!is_long($code)) {
$code = PHP_INT_MAX;
}
parent::__construct((string) $message, (int) $code, $previous);
$this->file = $file;
$this->line = $line;
}
开发者ID:explodybits,项目名称:hookr-plugin,代码行数:12,代码来源:Exception.php
示例19: connect
function connect($host, $port = 21)
{
// Setup server parameters
if (!is_long($port)) {
return false;
} else {
$ip = @gethostbyname($host);
$dns = @gethostbyaddr($host);
if (!$ip) {
$ip = $host;
}
if (!$dns) {
$dns = $host;
}
if (ip2long($ip) === -1) {
return false;
}
$this->_host = $ip;
$this->_fullhost = $dns;
$this->_port = $port;
$this->_dataport = $port - 1;
}
// Already connected
if ($this->_ready) {
return true;
}
// Attempt to connect
if (!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) {
return false;
}
// Wait for a welcome message
do {
if (!$this->_readmsg() || !$this->_checkCode()) {
return false;
}
$this->_lastaction = time();
} while ($this->_code < 200);
// Get remote system type
$syst = $this->getSystemType();
if ($syst) {
if (preg_match("/win|dos|novell/i", $syst[0])) {
$this->OS_remote = "w";
} elseif (preg_match("/os/i", $syst[0])) {
$this->OS_remote = "m";
} elseif (preg_match("/(li|u)nix/i", $syst[0])) {
$this->OS_remote = "u";
} else {
$this->OS_remote = "m";
}
}
$this->_ready = true;
return true;
}
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:53,代码来源:ftp.php
示例20: test_validation
function test_validation($val, $msg)
{
$f = filter_var($val, FILTER_VALIDATE_INT);
echo "{$msg} filtered: ";
var_dump($f);
// filtered value (or false)
echo "{$msg} is_long: ";
var_dump(is_long($f));
// test validation
echo "{$msg} equal: ";
var_dump($val == $f);
// test equality of result
}
开发者ID:badlamer,项目名称:hhvm,代码行数:13,代码来源:046.php
注:本文中的is_long函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论