SmartyPants-PHP is a PHP4 port of John Gruber's excellent SmartyPants quote-educator software.

What does it do? To paraphrase from the SmartyPants website:

SmartyPants-PHP is a function library that translates plain ASCII punctuation characters into “smart” typographic punctuation HTML entities.

SmartyPants-PHP can perform the following transformations:

For additional information on features, see the code and/or the readme document.

SmartyPants-PHP 1.5.1-r1 has been tested with PHP 4.3.2 and 4.3.3. (The 1.4.X series required 4.3.3; 1.5.X do not.)


Change Log

Changes to SmartyPants-PHP are recorded in the CHANGELOG.

Sample Usage

"She asked, 'Do nested quotes work?'... I answered, 'Yes, Ma'm -- of course they do.'"

    require_once './';
    echo SmartyPants($s);

“She asked, ‘Do nested quotes work?’… I answered, ‘Yes, Ma’m — of course they do.’”

Comments and Bug Reports

Send email to bugs (at) monauraljerk (dot) org


The original SmartyPants plug-in was written in PERL by John Gruber ( John's code was translated to PHP by matthew mcglynn ( Early testing and feedback was provided by Joseph Stump. Additional testing, bugfixes and feature suggestions by Kevin L. Papendick. The 1.5.1-b1 library was contributed by Alexander M. Rosenberg.

Copyright and License

Because SmartyPants-PHP is a modification of and redistribution of code authored by someone else, it is subject to the original's license terms, which can be found at the SmartyPants website.