File: modifier.explode.php

package info (click to toggle)
smarty4 4.5.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,136 kB
  • sloc: php: 18,847; yacc: 986; makefile: 48; sh: 12
file content (25 lines) | stat: -rw-r--r-- 541 bytes parent folder | download | duplicates (3)
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);
}