PHP Classes
elePHPant
Icontem

File: examples/CombinationsOf.php

Recommend this page to a friend!
  Classes of Christian Vigh  >  PHP Array Helpers  >  examples/CombinationsOf.php  >  Download  
File: examples/CombinationsOf.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Array Helpers
Perform several array manipulation operations
Author: By
Last change:
Date: 3 years ago
Size: 984 bytes
 

 

Contents

Class file image Download
<?php
   
/***********************************************************************************************************

        The following example demonstrates the use of the ArrayHelpers::CombinationsOf function.

     ***********************************************************************************************************/
   
require ( '../ArrayHelpers.phpclass' ) ;

    if (
php_sapi_name ( ) != 'cli' )
        echo (
"<pre>" ) ;

   
$array = [ [ 'a', 'b', 'c' ], 1, 2, [ 'x', 'y', 'z' ] ] ;

    echo
"********** Combinations of the following array :\n" ;
   
print_r ( $array ) ;
    echo
"---------- Result :\n" ;
   
print_r ( ArrayHelpers::CombinationsOf ( $array ) ) ;

    echo
"********** Combinations of an empty array :\n" ;
   
print_r ( ArrayHelpers::CombinationsOf ( [] ) ) ;

   
$array = [ 1, 2, 3, 4 ] ;

    echo
"********** Combinations of a flat array :\n" ;
   
print_r ( $array ) ;
    echo
"---------- Result :\n" ;
   
print_r ( ArrayHelpers::CombinationsOf ( $array ) ) ;