<?php
function tag($tag, $content = null, array $attributes = array()) {
$out = '<' . $tag;
foreach($attributes AS $key => $val) {
$out .= ' ' . $key . '="' . $val . '"';
}
if ($content === null) {
return $out . ' />';
}
return $out . '>' . $content . '</' . $tag . '>';
}
tag('h1', 'Header', array('class' => 'h1', 'id' => 'h1', 'style' => 'text-align:center;'));