grapheme_strpos

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)

grapheme_strposFind position (in grapheme units) of first occurrence of a string

Beschreibung

Prozeduraler Stil

grapheme_strpos(string $haystack, string $needle, int $offset = 0): int|false

Find position (in grapheme units) of first occurrence of a string

Parameter-Liste

haystack

The string to look in. Must be valid UTF-8.

needle

The string to look for. Must be valid UTF-8.

offset

The optional offset parameter allows you to specify where in haystack to start searching as an offset in grapheme units (not bytes or characters). If the offset is negative, it is treated relative to the end of the string. The position returned is still relative to the beginning of haystack regardless of the value of offset.

Rückgabewerte

Returns the position as an integer. If needle is not found, grapheme_strpos() will return false.

Changelog

Version Beschreibung
7.1.0 Support for negative offsets has been added.

Beispiele

Beispiel #1 grapheme_strpos() example

<?php

$char_a_ring_nfd 
"a\xCC\x8A";  // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) normalization form "D"
$char_o_diaeresis_nfd "o\xCC\x88"// 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) normalization form "D"

print grapheme_strpos$char_a_ring_nfd $char_a_ring_nfd $char_o_diaeresis_nfd$char_o_diaeresis_nfd);

?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

2

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

NEW88 – Nền Tảng Cá Cược Trực Tuyến Hàng Đầu Trong Thời Đại Số

NEW88 – Nền Tảng Cá Cược Trực Tuyến Hàng Đầu Trong Thời Đại Số Trong thời đại công nghệ số phát triển mạ ...

Geschrieben von new88betus am 30.03.2026 09:52:31
Forum: PHP Developer Forum
Fehler bei Beziehung

Man braucht dafür wirklich Erfahrung und ein gutes Verständnis der Quellcodeentwicklung. Updates und der Austausch von Wissen machen das Lernen ...

Geschrieben von boughtquota am 30.03.2026 08:39:28
Forum: PHP Developer Forum
PHP session expires too early when using fetch requests

The issue of session expiration piqued my interest, particularly in terms of how fetch requests may effect it. Could there be a correlation betwee ...

Geschrieben von bonuswrestler am 30.03.2026 06:58:55
Forum: PHP Developer Forum
PHP-Performance bei vielen externen Requests

Würde vor allem 3 Dinge machen: Parallel Requests (curl_multi oder Guzzle async) statt nacheinander Caching (Redis/Memcached, auch kurze TTL h ...

Geschrieben von hanmira31 am 30.03.2026 05:15:36
Forum: PHP Developer Forum