htmlEnt() public static méthode

Convert >, <, ', " and & to html entities, but preserves entities that are already encoded.
public static htmlEnt ( string $string, boolean $encodedEntities = false ) : string
$string string The text to be converted
$encodedEntities boolean
Résultat string
Exemple #1
0
 /**
  * @param $string
  * @return string
  */
 public static function html($string)
 {
     return Str::htmlEnt($string);
 }
Exemple #2
0
 public function testHtmlentities()
 {
     is('One &amp; Two &lt;&gt; &amp;mdash;', Str::htmlEnt('One & Two <> &mdash;'));
     is('One &amp; Two &lt;&gt; &mdash;', Str::htmlEnt('One &amp; Two <> &mdash;', true));
 }