Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Protected Attributes
Zend_Filter_Digits Class Reference
Inheritance diagram for Zend_Filter_Digits:
Zend_Filter_Interface

Public Member Functions

 __construct ()
 
 filter ($value)
 

Static Protected Attributes

static $_unicodeEnabled
 

Detailed Description

Definition at line 36 of file Digits.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Class constructor

Checks if PCRE is compiled with UTF-8 and Unicode support

Returns
void

Definition at line 52 of file Digits.php.

53  {
54  if (null === self::$_unicodeEnabled) {
55  self::$_unicodeEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
56  }
57  }

Member Function Documentation

◆ filter()

filter (   $value)

Defined by Zend_Filter_Interface

Returns the string $value, removing all but digit characters

Parameters
string$value
Returns
string

Implements Zend_Filter_Interface.

Definition at line 67 of file Digits.php.

68  {
69  if (!self::$_unicodeEnabled) {
70  // POSIX named classes are not supported, use alternative 0-9 match
71  $pattern = '/[^0-9]/';
72  } else if (extension_loaded('mbstring')) {
73  // Filter for the value with mbstring
74  $pattern = '/[^[:digit:]]/';
75  } else {
76  // Filter for the value without mbstring
77  $pattern = '/[\p{^N}]/';
78  }
79 
80  return preg_replace($pattern, '', (string) $value);
81  }
$pattern
Definition: website.php:22
$value
Definition: gender.phtml:16

Field Documentation

◆ $_unicodeEnabled

$_unicodeEnabled
staticprotected

Definition at line 43 of file Digits.php.


The documentation for this class was generated from the following file: