PHP code example of carloscarucce / mb-str-pad
1. Go to this page and download the library: Download carloscarucce/mb-str-pad library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
carloscarucce / mb-str-pad example snippets
$input = 'My text';
$length = 20;
$padding = ' '; // Optional. Default: ' '
$padType = STR_PAD_RIGHT; // Optional. Use STR_PAD_RIGHT, STR_PAD_LEFT or STR_PAD_BOTH. Default: STR_PAD_RIGHT
$encoding = null; //Optional. Default: null
$result = mb_str_pad($input, $length, $padding, $padType, $encoding);
var_dump($result); // string(20) "My text "