Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 13th, 2013  |  syntax: PHP  |  size: 0.40 KB  |  views: 74  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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;'));