nathggns/key_implode

This package is abandoned and no longer maintained. No replacement package was suggested.

Implode PHP array by both key and value

1.1.0 2013-11-27 11:51 UTC

This package is not auto-updated.

Last update: 2020-01-20 03:23:50 UTC


README

Implode PHP array by both key and value

Usage

string key_implode(string $pair_glue, string $glue, array $arr)

Given an associative array, key_implode() returns a string where both the keys and the values have been imploded by a specified glue.

key_implode(':', '/', [
    'page' => 2,
    'letter' => 'A'
]);

// page:2/letter:A

Installation

The easiest way to install this library is to use Composer and add the following to your project's composer.json.

{
    "require": {
        "nathggns/key_implode": "1.1.*"
    }
}

Then, when you run composer install, Composer should add this function to your project.

You do not need Composer to use this project, though. The alternative is to simply take the file src/key_implode.php and add it to your project.