PHP code example of nokitakaze / orthogonal_arrays

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

    

nokitakaze / orthogonal_arrays example snippets


$output = \NokitaKaze\OrthogonalArrays\Arrays::generateN2_values([
	['human', 'cat'],
	['boy', 'girl'],
	[true, false],
]);
foreach ($output as $line) {
	echo implode(', ', $line).";\n";
}
/* Output:
human, boy, 1;
human, girl, 1;
human, girl, ;
cat, boy, ;
cat, girl, 1;
*/

$output = \NokitaKaze\OrthogonalArrays\Arrays::generateN2_values([
	['female', 'male'],
	['catgirl'],
	[null, 10, 100500],
]);
foreach ($output as $line) {
	echo implode(', ', $line).";\n";
}
/* Output:
female, catgirl, ;
male, catgirl, ;
female, catgirl, 10;
male, catgirl, 10;
female, catgirl, 100500;
male, catgirl, 100500;
*/

$output = \NokitaKaze\OrthogonalArrays\Arrays::squeeze([
	['USA', 'SpaceX'],
	['USA', 'NASA'],
	['Russia', 'Roscosmos'],
	['Poland', null],
]);
foreach ($output as $line) {
	echo implode(', ', $line).";\n";
}
/* Output:
USA, SpaceX;
Russia, SpaceX;
Poland, SpaceX;
USA, NASA;
Russia, NASA;
Poland, NASA;
USA, Roscosmos;
Russia, Roscosmos;
Poland, Roscosmos;
USA, ;
Russia, ;
Poland, ;
*/