PHP code example of konfirm / isoflag

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

    

konfirm / isoflag example snippets


 

use Konfirm/ISOFlag/Flag;

$nl1 = Flag('NL');
$nl2 = Flag::NL();

 

use Konfirm/ISOFlag/Flag;

$flag = Flag::ES();

if ($flag === Flag::es()) {
	//  both are the exact same instance
}

if ($flag === new Flag('ES')) {
    //  new instances are never fully identical
}

if ($flag == new Flag('ES')) {
    //  they do compare to be similar
}

 

use Konfirm/ISOFlag/Flag;

if (Flag::hasFlag('US')) {
	//  the 'US' region has a flag
}

if (Flag::hasFlag('QQ')) {
	//  this is never reached
} else {
	//  'QQ' is not a valid region :()
}

 

use Konfirm/ISOFlag/Flag;

$flag = new Flag('CH');
$entities = $flag->toHTMLEntities();

// &#x1F1E8;&#x1F1ED;

 

use Konfirm/ISOFlag/Flag;

$flag = new Flag('DK');
$symbol = $flag->toUnicodeSymbol();

// πŸ‡©πŸ‡°

 

use Konfirm/ISOFlag/Flag;

$flag = new Flag('SE');
$symbol = (string) $flag;

// πŸ‡ΈπŸ‡ͺ