Zend_Filter_Inflector is a general purpose tool for
rules-based inflection of strings to a given target.
As an example, you may find you need to transform MixedCase or camelCasedWords into a path; for readability, OS policies, or other reasons, you also need to lower case this, and you want to separate the words using a dash ('-'). An inflector can do this for you.
Zend_Filter_Inflector implements
Zend_Filter_Interface; you perform inflection by calling
filter() on the object instance.
Example 425. Transforming MixedCase and camelCaseText to another format
<?php
$inflector = new Zend_Filter_Inflector('pages/:page.:suffix');
$inflector->setRules(array(
':page' => array('Word_CamelCaseToDash', 'StringToLower'),
'suffix' => 'html'
));
$string = 'camelCasedWords';
$filtered = $inflector->filter(array('page' => $string));
// pages/camel-cased-words.html
$string = 'this_is_not_camel_cased';
$filtered = $inflector->filter(array('page' => $string));
// pages/this_is_not_camel_cased.html




