Function __global->cms_preg_grep_safe

Definitions

sources/global3.php

  • Array entries that match the pattern.Automatically applies utf-8 if possible and appropriate. \s is not actually Unicode-safe, for example (as it matches non-breaking-spaces).Also automatically applies the 'D' modifier so that trailing blank lines don't mess with '$'.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$pattern string No No required parameter N/A N/A The pattern
$subject array No No required parameter N/A N/A The subject strings
$flags integer No No 0 N/A N/A Either 0, or PREG_GREP_INVERT

Returns

  • Matches
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Array entries that match the pattern.Automatically applies utf-8 if possible and appropriate. \s is not actually Unicode-safe, for example (as it matches non-breaking-spaces).Also automatically applies the 'D' modifier so that trailing blank lines don't mess with '$'.
 *
 * @param  string $pattern The pattern
 * @param  array $subject The subject strings
 * @param  integer $flags Either 0, or PREG_GREP_INVERT
 * @return array Matches
 */

function cms_preg_grep_safe(string $pattern, array $subject, int $flags = 0) : array