// if (is_string($string)) {
// return "'" . mb_ereg_replace('[\x00\x0A\x0D\x1A\x22\x27\x5C]', '\\\0', $string) . "'";
// }
// For other types (int, float, bool), convert to string
// return (string)$string; Notice: Undefined offset: 1 Hatası
1
●66
- 23-02-2025, 21:19:59İlgili hatanın bulunduğu satırlar aşağıdadır. Çözümünde destek olabilecek var mıdır?
- 23-02-2025, 21:31:59
function escapeString($string) { // Eğer string ise özel karakterleri escape et if (is_string($string)) { return "'" . mb_ereg_replace('[x00x0Ax0Dx1Ax22x27x5C]', '', $string) . "'"; } // Diğer veri tipleri için stringe dönüştür return (string)$string; }Örnek kullanım
$stringValue = "O'Brien"; // String değer $intValue = 42; // Integer değer echo escapeString($stringValue); // Çıktı: 'O'Brien' echo escapeString($intValue); // Çıktı: 42