PHP code example of zenstruck / string
1. Go to this page and download the library: Download zenstruck/string 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/ */
zenstruck / string example snippets
$ret = remove_whitespace(" foo \n\n\n \r bar"); // $ret = "foo bar"
$ret = null_trim(" foo bar "); // $ret = "foo bar"
$ret = null_trim(" "); // $ret = null
$ret = null_trim(array(" foo bar ", " ")); // $ret = array("foo bar", null)
$ret = null_trim("foo / ", "/ "); // $ret = "foo"
$ret = truncate_word(" foo bar baz", 10); // $ret = "foo bar..."