Package Home

Zend Framework 2 Documentation (Manual)

PHK Home

File: /_sources/modules/zend.filter.string-to-upper.txt

Size:1083
Storage flags:no_autoload,compress/gzip (45%)

.. _zend.filter.set.stringtoupper:

StringToUpper
-------------

This filter converts any input to be uppercased.

.. _zend.filter.set.stringtoupper.options:

Supported Options
^^^^^^^^^^^^^^^^^

The following options are supported for ``Zend\Filter\StringToUpper``:

- **encoding**: This option can be used to set an encoding which has to be used.

.. _zend.filter.set.stringtoupper.basic:

Basic Usage
^^^^^^^^^^^

This is a basic example for using the ``StringToUpper`` filter:

.. code-block:: php
   :linenos:

   $filter = new Zend\Filter\StringToUpper();

   print $filter->filter('Sample');
   // returns "SAMPLE"

.. _zend.filter.set.stringtoupper.encoding:

Different Encoded Strings
^^^^^^^^^^^^^^^^^^^^^^^^^

Like the ``StringToLower`` filter, this filter handles only characters from the actual locale of your server. Using
different character sets works the same as with ``StringToLower``.

.. code-block:: php
   :linenos:

   $filter = new Zend\Filter\StringToUpper(array('encoding' => 'UTF-8'));

   // or do this afterwards
   $filter->setEncoding('ISO-8859-1');



For more information about the PHK package format: http://phk.tekwire.net