Skip to content

Instantly share code, notes, and snippets.

View petrkotek's full-sized avatar

Petr Kotek petrkotek

View GitHub Profile
<?php
/**
* Replacement of str_split() function with multi-byte encoding support.
*
* @param string $string The input string.
* @param int $string_length [optional] Maximum length of the chunk.
* @param string $charset Character encoding.
*
* @return array
/**
* Sets a default value for a given input.
*
* @param mixed input
* @param string defaultValue
* @return string
*/
module.filter('default', function() {
return function(input, defaultValue) {
return input ? input : defaultValue;