Created
September 2, 2013 14:09
-
-
Save djave-co/6413280 to your computer and use it in GitHub Desktop.
PHP Wrap
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
// Wraps a string in an html tag quickly | |
// e.g. wrap("hi"); | |
function wrap($text, $tag='p', $echo=true, $class=''){ | |
if($class!=''){ | |
$class = " class='$class'"; | |
} | |
$string = "<$tag$class>$text</$tag>"; | |
if(!$echo){ | |
return $string; | |
} | |
echo $string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment