Jump to content

Help with filter!


Superian

Recommended Posts

How could I make this into one function instead of having to use two?

 

<?php
function check_plain($text) {
  return _validate_utf8($text) ? htmlspecialchars($text, ENT_QUOTES) : '';
}

function _validate_utf8($text) {
  if (strlen($text) == 0) {
    return TRUE;
  }
  return (preg_match('/^./us', $text) == 1);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/119163-help-with-filter/#findComment-613628
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.