Advertisement
Guest User

Untitled

a guest
Feb 13th, 2013
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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;'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement