src/PaymentSlipData.php
protected function breakStringIntoBlocks($string, $blockSize = 5, $alignFromRight = true)
    {
        // Lets reverse the string (because we want the block to be aligned from the right)
        if ($alignFromRight === true) {
            $string = strrev($string);
        }

        // Chop it into blocks
        $string = trim(chunk_split($string, $blockSize, ' '));

        // Re-reverse
        if ($alignFromRight === true) {
            $string = strrev($string);
        }

        return $string;
    }
protected function breakStringIntoBlocks($string, $blockSize = 5, $alignFromRight = true)
    {
        // Lets reverse the string (because we want the block to be aligned from the right)
        if ($alignFromRight === true) {
            $string = strrev($string);
        }

        // Chop it into blocks
        $string = trim(chunk_split($string, $blockSize, ' '));

        // Re-reverse
        if ($alignFromRight === true) {
            $string = strrev($string);
        }

        return $string;
    }
protected function breakStringIntoBlocks ( $ string , $ blockSize = 5 , $ alignFromRight = true ) { // Lets reverse the string (because we want the block to be aligned from the right) if ( $ alignFromRight === true ) { $ string = strrev ( $ string ) ; } // Chop it into blocks $ string = trim ( chunk_split ( $ string , $ blockSize , ' ' ) ) ; // Re-reverse if ( $ alignFromRight === true ) { $ string = strrev ( $ string ) ; } return $ string ; }
Get a given string broken down in blocks of a certain size

Example: 000000000000000 becomes more readable 00000 00000 00000

@param string $string The to be formatted string.
@param int $blockSize The Block size of choice.
@param bool $alignFromRight Right aligned, blocks are build from right.
@return string Given string divided in blocks of given block size separated by one space.
Get a given string broken down in blocks of a certain size