PHP code example of ecommit / scalar-values

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

    

ecommit / scalar-values example snippets


use Ecommit\ScalarValues\ScalarValues;

$array = ['str1', 2, 3];
if (ScalarValues::containsOnlyScalarValues($array)) { //True
    //...
} else {
    //...
}

$array = ['str1', ['tab'], 3];
if (ScalarValues::containsOnlyScalarValues($array)) { //False
    //...
} else {
    //...
}

use Ecommit\ScalarValues\ScalarValues;

$array = ['str1', ['tab'], 3];
$newArray = ScalarValues::filterScalarValues($array); //[0 => 'str1', 2 => 3]