aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/smarty/smarty/libs/plugins/modifier.explode.php
blob: 5186fde3d9e24b9f3f37734b3d4d6f2b3eb90026 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
/**
 * Smarty plugin
 *
 * @package    Smarty
 * @subpackage PluginsModifier
 */

/**
 * Smarty explode modifier plugin
 * Type:     modifier
 * Name:     explode
 * Purpose:  split a string by a string
 *
 * @param string   $separator
 * @param string   $string
 * @param int|null $limit
 *
 * @return array
 */
function smarty_modifier_explode($separator, $string, ?int $limit = null)
{
    // provide $string default to prevent deprecation errors in PHP >=8.1
    return explode($separator, $string ?? '', $limit ?? PHP_INT_MAX);
}