Created
November 17, 2011 19:58
-
-
Save madbonkey/1374307 to your computer and use it in GitHub Desktop.
HTML Element function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!function_exists("html_element")) { | |
function html_element($element, $attributes, $innerHTML = false) { | |
if(empty($element) || empty($attribues) || !is_array($attributes)) | |
return false; | |
$output = '<'.$element; | |
foreach($attribues as $attr => $val) { | |
if(empty($val)) | |
$output .= ' '.$attr; | |
else | |
$output .= ' '.$attr.'="'.$val.'"'; | |
} | |
$output .= '>'; | |
if($innerHTML != false) | |
$output .= $innerHTML; | |
$output .= sprintf('</%s>', $element); | |
return $output; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment