PEAR logo

HTML_CSS : The Definitive Guide

To Array

HTML_CSS::toArray() must be considered as a debug/help function. An easy way to explore HTML_CSS data structures.

For example, explore these definitions :

html, body {
  margin: 2px;
  padding: 0px;
  border: 0px;
}

p, body {
  margin: 4px;
}

div#header { text-align: center; color: red; }
     

With script :

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

$css = new HTML_CSS();

$strcss = '
html, body {
  margin: 2px;
  padding: 0px;
  border: 0px;
}

p, body {
  margin: 4px;
}

div#header { text-align: center; color: red; }
';
$css->parseString($strcss);

$arr = $css->toArray();
echo '<pre>';
var_dump($arr);
echo '</pre>';
?>
      
     

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