Documentation

Keyword
in package

Quote-aware keyword scanning class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
7.0.0

Table of Contents

Methods

indexOf()  : int|false
Find the position of the first occurrence of $needle in $haystack, ignoring any occurrence found inside a single-quoted, double-quoted or backtick-quoted span.
split()  : array<string|int, mixed>
Split an expression string on AND/OR (case-sensitive, word-boundary-aware), ignoring matches inside a quoted span. Returns the same alternating [expr, 'AND'|'OR', expr, ...] shape as the preg_split call it replaces.
matchKeywordAt()  : string|null
Determine if one of the given keywords matches exactly (case-sensitive) at the given position, bounded by non-alphanumeric/non-underscore characters on both sides.

Methods

indexOf()

Find the position of the first occurrence of $needle in $haystack, ignoring any occurrence found inside a single-quoted, double-quoted or backtick-quoted span.

public static indexOf(string $haystack, string $needle[, int $offset = 0 ][, bool $caseInsensitive = true ]) : int|false
Parameters
$haystack : string
$needle : string
$offset : int = 0
$caseInsensitive : bool = true
Return values
int|false

split()

Split an expression string on AND/OR (case-sensitive, word-boundary-aware), ignoring matches inside a quoted span. Returns the same alternating [expr, 'AND'|'OR', expr, ...] shape as the preg_split call it replaces.

public static split(string $expression) : array<string|int, mixed>
Parameters
$expression : string
Return values
array<string|int, mixed>

matchKeywordAt()

Determine if one of the given keywords matches exactly (case-sensitive) at the given position, bounded by non-alphanumeric/non-underscore characters on both sides.

protected static matchKeywordAt(string $expression, int $position, array<string|int, mixed> $keywords) : string|null
Parameters
$expression : string
$position : int
$keywords : array<string|int, mixed>
Return values
string|null

        
On this page

Search results