RedBeanPHP\QueryWriter\AQueryWriter::canBeTreatedAsInt PHP Method

canBeTreatedAsInt() public static method

Checks whether a number can be treated like an int.
public static canBeTreatedAsInt ( string $value ) : boolean
$value string string representation of a certain value
return boolean
    public static function canBeTreatedAsInt($value)
    {
        return (bool) (strval($value) === strval(intval($value)));
    }

Usage Example

コード例 #1
0
ファイル: Debug.php プロジェクト: gabordemooij/redbean
 /**
  * Fills in a value of a binding and truncates the
  * resulting string if necessary.
  *
  * @param mixed $value bound value
  *
  * @return string
  */
 protected function fillInValue($value)
 {
     if (is_null($value)) {
         $value = 'NULL';
     }
     $value = strval($value);
     if (strlen($value) > $this->strLen) {
         $value = substr($value, 0, $this->strLen) . '... ';
     }
     if (!\RedBeanPHP\QueryWriter\AQueryWriter::canBeTreatedAsInt($value) && $value !== 'NULL') {
         $value = '\'' . $value . '\'';
     }
     return $value;
 }
All Usage Examples Of RedBeanPHP\QueryWriter\AQueryWriter::canBeTreatedAsInt