Skip to content

Instantly share code, notes, and snippets.

@djave-co
Created September 2, 2013 14:09
Show Gist options
  • Save djave-co/6413280 to your computer and use it in GitHub Desktop.
Save djave-co/6413280 to your computer and use it in GitHub Desktop.
PHP Wrap
// 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