PHP code example of petemc / transpose

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

    

petemc / transpose example snippets




use function PeteMc\Transpose\transpose;

$input = [
    'names' => ['adam', 'ben', 'claire'],
    'ages' => [24, 32, 52],
    'emails' => ['[email protected]', '[email protected]', '[email protected]'],
];

$transposed = transpose($input);

/*
$transposed is equal to
[
    ['adam', 24, '[email protected]'],
    ['ben', 32, '[email protected]'],
    ['claire', 52, '[email protected]'],
];
*/