PHP code example of mulertech / char-manipulation

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

    

mulertech / char-manipulation example snippets


php composer.phar update

CharManipulation::specialCharsTrim(' Test trim ');

// 'Test trim'

CharManipulation::specialCharsTrim([' Test "trim"', '<script\>with</script>', ' array  ', ' and', 'null ', null]);

// ['Test &quot;trim&quot;', 'with', 'array', 'and', 'null', null]

$test = '&#039;test single quote';
CharManipulation::specialCharsDecode($test);

// echo $test;
// "'test single quote";

$test = [
            'test1' => '&#039;test single quote',
            'test2' => 'test quote&quot;',
            'test3' => 'with null',
            'test4' => null,
            'test5' => [
                'test5a' => "&#039;test single quote",
                'test5b' => 'test quote&quot;',
                'test5c' => 'with null',
                'test5d' => null
            ]
        ];
CharManipulation::specialCharsDecode($test);

// echo $test;
// [
        'test1' => "'test single quote",
        'test2' => 'test quote"',
        'test3' => 'with null',
        'test4' => null,
        'test5' => [
            'test5a' => "'test single quote",
            'test5b' => 'test quote"',
            'test5c' => 'with null',
            'test5d' => null
        ]
   ];