Advertisement
Guest User

Untitled

a guest
Feb 13th, 2013
594
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 = null) {
  3.  
  4.    $out = '<' . $tag;
  5.    if ($attributes !== null) {
  6.      foreach($attributes AS $key => $val) {
  7.        $out .= ' ' . $key . '="' . $val . '"';
  8.      }
  9.    }
  10.  
  11.    if ($content === null) {
  12.       return $out . ' />';
  13.    }
  14.  
  15.    return $out . '>' . $content . '</' . $tag . '>';
  16.  
  17. }
  18.  
  19. tag('h1', 'Header', array('class' => 'h1', 'id' => 'h1', 'style' => 'text-align:center;'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement