SHARE
TWEET

Untitled

a guest Feb 13th, 2013 75 Never
  1. <?php
  2. function tag($tag, $content = null, array $attributes = array()) {
  3.  
  4.    $out = '<' . $tag;
  5.    foreach($attributes AS $key => $val) {
  6.      $out .= ' ' . $key . '="' . $val . '"';
  7.    }
  8.  
  9.    if ($content === null) {
  10.       return $out . ' />';
  11.    }
  12.  
  13.    return $out . '>' . $content . '</' . $tag . '>';
  14.  
  15. }
  16.  
  17. tag('h1', 'Header', array('class' => 'h1', 'id' => 'h1', 'style' => 'text-align:center;'));
RAW Paste Data
Top