Base de conhecimentoCentro de Exames
PT · PTPortuguês (Portugal)
Escolher idioma13

CKTIS / PHP

strripos()

Encontra a última posição correspondente sem distinguir maiúsculas ASCII.

Versão: PHP 8.4; repository runtime, production runtime not attested

Sintaxe

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

Encontra a última posição correspondente sem distinguir maiúsculas ASCII. Um deslocamento positivo exclui inícios anteriores, um negativo limita o último início desde o fim. O índice está em bytes e zero deve distinguir-se de false.

Assinatura

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

Saída do exemplo

[6,6,3,false]

Exemplos

<?php
$s="AbxABxab"; echo json_encode([strripos($s,"aB"),strripos($s,"aB",4),strripos($s,"aB",-4),strripos($s,"zz")]);

Resultado

[6,6,3,false]

Fontes