Skip to content

Instantly share code, notes, and snippets.

@westonwatson
Created April 10, 2014 16:38
Show Gist options
  • Save westonwatson/10400413 to your computer and use it in GitHub Desktop.
Save westonwatson/10400413 to your computer and use it in GitHub Desktop.
html_tag helper method
function html_tag($tag_name,$options=null){
$html = "<";
$html .= $tag_name;
if ($options){
if (is_array($options)){
$html .= " ";
foreach($options as $key => $val){
$html .= "{$key}=\"{$val}\" ";
}
}elseif(is_string($options)){
$html .= " {$options}";
}
}
$html .= ">";
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment