Dieses Code Snippet dient dem Suchen und Löschen von /**/ Kommentaren in einem String $string = preg_replace(„#/*(.*?)*/#s“, „“, $string);[/php]
Dieses Code Snippet dient dem Suchen und Löschen von /**/ Kommentaren in einem String $string = preg_replace(„#/*(.*?)*/#s“, „“, $string);[/php]
Einen String mit Hilfe von PHP für MySQL in UTF-8 konvertieren function fixEncoding($in_str) { $cur_encoding = mb_detect_encoding($in_str) ; if($cur_encoding == „UTF-8″ && mb_check_encoding($in_str,“UTF-8“)) return $in_str; else return utf8_encode($in_str); }[/php]
Routine Restore htmlspecialchars function restore_hsc($len){ $val = str_replace(‚&‘, ‚&‘, $val); $val = str_replace(‚ö‘, ‚�‘, $val); $val = str_replace(‚ä‘, ‚�‘, $val); $val = str_replace(‚ü‘, ‚�‘, $val); $val = str_replace(‚<‘, ‚<‚, $val); $val = str_replace(‚>‘, ‚>‘, $val); $val = str_replace(‚"‘, ‚“‚, $val); return $val; } [/php] Quelle: Johnas John
Eine Routine zum Entfernen doppelter Zeilen /** * RemoveDuplicatedLines * This function removes all duplicated lines of the given text file. * * @param string * @param bool * @return string */ function RemoveDuplicatedLines($Filepath, $IgnoreCase=false, $NewLine=“n“){ if (!file_exists($Filepath)){ $ErrorMsg = ‚RemoveDuplicatedLines error: ‚; $ErrorMsg .= ‚The given file ‚ . $Filepath . ‚ does not […]