Oihana PHP Arango

like.php

Table of Contents

Functions

like()  : string
Check whether a pattern matches a string using wildcard matching.

Functions

like()

Check whether a pattern matches a string using wildcard matching.

like(string $text, string $search[, bool $caseInsensitive = false ]) : string

This helper wraps the ArangoDB AQL function LIKE(text, search, caseInsensitive) which checks if the text matches the search pattern using wildcard characters. The pattern supports wildcards: _ (single character) and % (multiple characters).

Example AQL usage:

LIKE("hello", "h%")           // returns true
LIKE("hello", "h_llo")        // returns true
LIKE("hello", "world")        // returns false
LIKE("Hello", "h%", true)     // returns true (case-insensitive)
LIKE("hello", "\\_")          // returns false (literal underscore)
Parameters
$text : string

The text to search in.

$search : string

The search pattern with wildcards (_ and %).

$caseInsensitive : bool = false

When true, matching is case-insensitive (maps to AQL's third caseInsensitive argument). Default false = case-sensitive.

Tags
example
use function oihana\arango\db\functions\strings\like;

echo like('doc.name', '"John%"');        // LIKE(doc.name,"John%")        case-sensitive
echo like('doc.name', '"john%"', true);  // LIKE(doc.name,"john%",true)   case-insensitive
see
https://docs.arangodb.com/stable/aql/functions/string/#like
contains()

For simple substring matching.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results