Skip to content

Instantly share code, notes, and snippets.

@chrisshennan
Last active August 27, 2015 11:17
Show Gist options
  • Save chrisshennan/5ff23139bdbe7fcd11a1 to your computer and use it in GitHub Desktop.
Save chrisshennan/5ff23139bdbe7fcd11a1 to your computer and use it in GitHub Desktop.
Generating a title with or without a tag
<?php
function generateLabelContent($includeHref = true) {
if($includeHref) {
$content = '<a href="http://www.google.co.uk">Google</a>';
} else {
$content = "Google";
}
return $content;
}
echo generateLabelContent(true) . "<br/>";
echo generateLabelContent(false) . "<br/>";
<?php
function generateLabelContent($includeHref = true) {
$content = '<a href="http://www.google.co.uk">Google</a>';
if(!$includeHref) {
$content = strip_tags($content);
}
return $content;
}
echo generateLabelContent(true) . "<br/>";
echo generateLabelContent(false) . "<br/>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment