PHP code example of codekandis / converters

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

    

codekandis / converters example snippets


$value = false;

( new IntegerToBinaryStringUniDirectionalConverter() )
    ->convert( $value );
/**
 * 0
 */

$value = 0;

( new BinaryStringToIntegerUniDirectionalConverter() )
    ->convert( $value );
/**
 * false
 */

$value = 42;

( new IntegerToBinaryStringBiDirectionalConverter() )
    ->convertTo( $value );
/**
 * '101010'
 */

$value = '101010';

( new IntegerToBinaryStringBiDirectionalConverter() )
    ->convertFrom( $value );
/**
 * 42
 */