Answers for "php remove –"

PHP
5

php remove last character from string

$hell = substr('hello', 0, -1);
Posted by: Guest on November-04-2019
0

php filter non utf-8 characters

function remove_bs($Str) {  
  $StrArr = str_split($Str); $NewStr = '';
  foreach ($StrArr as $Char) {    
    $CharNo = ord($Char);
    if ($CharNo == 163) { $NewStr .= $Char; continue; } // keep £ 
    if ($CharNo > 31 && $CharNo < 127) {
      $NewStr .= $Char;    
    }
  }  
  return $NewStr;
}
Posted by: Guest on August-25-2020

Browse Popular Code Answers by Language