pspell_new

FunctionRemoved in PHP 8.4

Load a new dictionary.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
Improved
PHP 8.2-8.3
PHP 8.4
Removed
PHP 8.5
PHP 8.6

pspell_new Function synopsis

pspell_new(
    string $language,
    string $spelling = "",
    string $jargon = "",
    string $encoding = "",
    int $mode = 0
  ): PSpell\Dictionary|false

Parameters

$language

Typestring

The language parameter is the language code which consists of the two letter ISO 639 language code and an optional two letter ISO 3166 country code after a dash or underscore.

$spelling

OptionalTypestringDefault value""

The spelling parameter is the requested spelling for languages with more than one spelling such as English. Known values are 'american', 'british', and 'canadian'.

$jargon

OptionalTypestringDefault value""

The jargon parameter contains extra information to distinguish two different words lists that have the same language and spelling parameters.

$encoding

OptionalTypestringDefault value""

The encoding parameter is the encoding that words are expected to be in. Valid values are 'utf-8', 'iso8859-*', 'koi8-r', 'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned 32'. This parameter is largely untested, so be careful when using.

$mode

OptionalTypeintDefault value0

The mode parameter is the mode in which spellchecker will work. There are several modes available:

   Mode is a bitmask constructed from different constants listed above.
   However, [`PSPELL_FAST`](/codex/PSPELL_FAST),
   [`PSPELL_NORMAL`](/codex/PSPELL_NORMAL) and
   [`PSPELL_BAD_SPELLERS`](/codex/PSPELL_BAD_SPELLERS) are mutually exclusive, so you
   should select only one of them.

$mode accepts one of the following constant values:

Return value

TypePSpell\Dictionary|false

Returns an PSpell\Dictionary instance on success, or false on failure.

Changes to the pspell_new Function

PHP 8.4

  • Function removed

PHP 8.1

  • Return type changed: int|false to PSpell\Dictionary|false
  pspell_new(
      string $language,
      string $spelling = "",
      string $jargon = "",
      string $encoding = "",
      int $mode = 0
-   ): int|false
+   ): PSpell\Dictionary|false

PHP 8.0

  • Return type added: int|false
  • Parameter type added for parameter #1 ($language): string
  • Parameter type added for parameter #2 ($spelling): string
  • Parameter default value added for position #2 ($spelling): ""
  • Parameter type added for parameter #3 ($jargon): string
  • Parameter default value added for position #3 ($jargon): ""
  • Parameter type added for parameter #4 ($encoding): string
  • Parameter default value added for position #4 ($encoding): ""
  • Parameter type added for parameter #5 ($mode): int
  • Parameter default value added for position #5 ($mode): 0
  pspell_new(
-     $language,
+     string $language,
-     $spelling,
+     string $spelling = "",
-     $jargon,
+     string $jargon = "",
-     $encoding,
+     string $encoding = "",
-     $mode
+     int $mode = 0
-   )
+   ): int|false

pspell_new Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release No
PHP 8.5Supported (Latest) No
PHP 8.4Supported No
PHP 8.3Security-Fixes Only Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Unsupported Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes