本文整理汇总了PHP中is_long函数的典型用法代码示例。如果您正苦于以下问题:PHP is_long函数的具体用法?PHP is_long怎么用?PHP is_long使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_long函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 '?';
}
示例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);
}
示例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;
}
示例4: __construct
public function __construct($key)
{
if (!is_long($key)) {
E("传入了非法的信号量key");
}
$this->ipc_signal = sem_get($key);
}
示例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);
}
示例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);
}
}
示例7: setISBN
public function setISBN($isbn)
{
if (!is_long($isbn)) {
throw new InvalidArgumentException('"' . $isbn . '" is not a valid long.');
}
$this->isbn = $isbn;
}
示例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;
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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];
}
示例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;
}
示例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);
}
}
}