PHP code example of carloscarucce / substr-position

1. Go to this page and download the library: Download carloscarucce/substr-position 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 / substr-position example snippets


//Basic usage
$original = 'test';
$valueToAdd = 'abc';
substr_position($original, $valueToAdd, 2); //string(5) "teabc"

//Limiting result size
substr_position("test", "abc", 2, 4); //string(4) "teab"

//Adding to a position beyond original string maxlength
substr_position("test", "abc", 10); //string(13) "test      abc"