PHP code example of lemmon / clsx

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

    

lemmon / clsx example snippets


echo clsx('foo', true && 'bar', 'baz');
// Output: 'foo bar baz'

echo clsx(['foo', 0, false, 'bar']);
// Output: 'foo bar'

echo clsx(['foo'], ['', 0, false, 'bar'], [['baz', [['hello'], 'there']]], 'bye');
// Output: 'foo bar baz hello there bye'

echo clsx(['foo' => true, 'bar' => false, 'baz' => isSomethingTrue()]);
// Output: 'foo baz'

echo clsx(['foo' => true], ['--special' => 'active']);
// Output: 'foo --special'

clsx(true, false, '', null, 0);
// Output: ''