PEAR logo

HTML_CSS : The Definitive Guide

To String

HTML_CSS::toString() is analogous to HTML_CSS::toFile() except that result is capture to a PHP variable rather than to a text/css file.

      
<?php
require_once 'HTML/CSS.php';

$css = new HTML_CSS();

$strcss = '
ul, body {
  padding: 1em 2em;
}
';
$css->parseString($strcss);
$css->setGroupStyle(1, 'color', 'red');

$str = $css->toString();
echo $str;
// will display
// ul, body { padding: 1em 2em; color: red; }
?>
      
     

HTML_CSS : The Definitive Guide v 1.0.0 : June 24, 2006