Skip to content

Instantly share code, notes, and snippets.

@cp-sumi-k
Last active May 19, 2022 11:08
Show Gist options
  • Save cp-sumi-k/50abfe74d60a81eb4e8c6f05a7f8d850 to your computer and use it in GitHub Desktop.
Save cp-sumi-k/50abfe74d60a81eb4e8c6f05a7f8d850 to your computer and use it in GitHub Desktop.
<?php
$str = "<a href='https://canopas.com'>Let's explore</a>";
echo htmlentities($str); // in browser
error_log(htmlentities($str)); // in console
/*
output
In browser : <a href='https://canopas.com'>Let's explore</a>
In console : &lt;a href=&#039;https://canopas.com&#039;&gt;Let&#039;s explore&lt;/a&gt;
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment