Function __global->cms_mb_chunk_split

Definitions

sources/global4.php

  • Split a string into smaller chunks, with utf-8 awareness where possible/required. Can be used to split a string into smaller chunks which is useful for e.g. converting base64_encode output to match RFC 2045 semantics. It inserts end (defaults to "\r\n") every chunklen characters.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$str string No No required parameter N/A N/A The input string
$len integer No No 76 N/A N/A The maximum chunking length
$glue string No No N/A N/A Split character
$force boolean No No False N/A N/A Whether to force unicode as on

Returns

  • The chunked version of the input string
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Split a string into smaller chunks, with utf-8 awareness where possible/required. Can be used to split a string into smaller chunks which is useful for e.g. converting base64_encode output to match RFC 2045 semantics. It inserts end (defaults to "\r\n") every chunklen characters.
 *
 * @param  string $str The input string
 * @param  integer $len The maximum chunking length
 * @param  string $glue Split character
 * @param  boolean $force Whether to force unicode as on
 * @return string The chunked version of the input string
 */

function cms_mb_chunk_split(string $str, int $len = 76, string $glue = '
'
, bool $force = false) : string