begins_with

Summary

Checks if an array starts with a specific element/sequence.

Usage

input|begins_with( element1 [, element2 [, ... ] ] )

Parameters

NameTypeDescriptionRequired
element1 any An element that should be matched. Yes.
element2 any Another element that should be matched. No.

Returns

TRUE or FALSE.

Description

This operator checks if the input array starts with a specified sequence of elements. If yes, the operator returns TRUE, otherwise FALSE will be returned.

Examples

Example 1

{array( 1, 2, 3, 4, 5, 6, 7 )|begins_with( 1, 2, 3 )}

Returns TRUE.

Example 2

{array( 1, 2, 3, 4, 5, 6, 7 )|begins_with( 2, 3, 4 )}

Returns FALSE.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.