PHP code example of emanuelecoppola / smartwrap

1. Go to this page and download the library: Download emanuelecoppola/smartwrap 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/ */

    

emanuelecoppola / smartwrap example snippets


use EmanueleCoppola\SmartWrap\SmartWrap;

$sw = new SmartWrap();

$wrapped = $sw->smartwrap('hello! heeeeeeeeeeeeeeereisaverylongword', 20, "\n", true);

print($wrapped);

// Or by using the global function
$wrapped = smartwrap('hello! heeeeeeeeeeeeeeereisaverylongword', 20, "\n", true);

print($wrapped);

$output = wordwrap('hello! heeeeeeeeeeeeeeereisaverylongword', 20, "\n", true);
// The output will be ↓
$output == "hello!\nheeeeeeeeeeeeeeereis\naverylongword";

$output = smartwrap('hello! heeeeeeeeeeeeeeereisaverylongword', 20, "\n", true);
// The output will be ↓
$output == "hello! heeeeeeeeeeee\neeereisaverylongword";