Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

stripos()

Find the first matching byte position while ignoring ASCII letter case.

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

Syntax

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

Find the first matching byte position while ignoring ASCII letter case. Offsets choose the starting position and the returned index is relative to the entire haystack. Since PHP 8.2 folding is locale-independent. Use a strict false check because zero is a valid match.

Signature

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

Example output

[0,3,false]

Examples

<?php
$s="Ab-aB"; echo json_encode([stripos($s,"ab"),stripos($s,"AB",1),stripos($s,"z")]);

Result

[0,3,false]

Sources