WissensdatenbankPrüfungszentrum
DEDeutsch
Sprache wählen13

CKTIS / PHP

str_ireplace()

Ersetzt wörtliche Treffer ohne Beachtung der ASCII-Großschreibung.

Version: PHP 8.4; repository runtime, production runtime not attested

Syntax

str_ireplace(array|string $search, array|string $replace, array|string $subject, int &$count = null): array|string

Ersetzt wörtliche Treffer ohne Beachtung der ASCII-Großschreibung. Seit PHP 8.2 ist dies locale-unabhängig und umfasst nicht alle Unicode-Buchstaben. count erhält die Gesamtzahl, ein Array-Ergebnis bewahrt die Schlüssel.

Signatur

str_ireplace(array|string $search, array|string $replace, array|string $subject, int &$count = null): array|string

Ausgabe des Beispiels

[{"a":"XX","b":"X"},3,"É"]

Beispiele

<?php
$out=str_ireplace("ab","X",["a"=>"ABab","b"=>"Ab"],$count);
echo json_encode([$out,$count,str_ireplace("\u{00E9}","x","\u{00C9}")],JSON_UNESCAPED_UNICODE);

Ergebnis

[{"a":"XX","b":"X"},3,"É"]

Quellen