Chapter 8. Xyster_Filter

Table of Contents

8.1. Overview
8.1.1. TitleCase

8.1. Overview

The filter classes available from the Xyster Framework are listed here. Remember to add the Xyster_Filter namespace to the options when using Zend_Filter.

For more information about the use of filter classes, see the Zend Framework documentation for Zend_Filter.

8.1.1. TitleCase

PHP lacks the function to convert a string to title case because often times doing so is subjective. It also usually follows English-specific language rules.

Title case is making the first letter of important words uppercase, and keeping the rest lowercase. Lowercase words include prepositions and conjunctions.

<?php
require_once 'Xyster/Filter/TitleCase.php';
$filter = new Xyster_Filter_TitleCase();
echo $filter->filter("the dogs came out of the rain");
// prints The Dogs Came out of the Rain