Giter Club home page Giter Club logo

associative-implode's Introduction

Associative Implode

This is a submodule of TaylorNetwork\LaravelHelpers.

It should be installed as a component of TaylorNetwork\LaravelHelpers for it to work properly with Laravel.

Usage

associative_implode accepts a minimum of 3 parameters, see table below.

Parameter # Description Type Suggested Value
1 The glue between the array key and value string '='
2 The glue between each array key/value pair string ' '
3 The array to implode array -

For all examples the following array will be used.

$array = [
    'class' => 'class1 class2 class3',
    'id' => 'elementID',
    'data' => 'value',
];

Default

By default the array values are quoted with "

associative_implode('=', ' ', $array);

Returns

'class="class1 class2 class3" id="elementID" data="value"'

Additional Parameters

There are an additional 3 parameters that associative_implode accepts.

Parameter # Description Type Default Value
4 Quote the array keys boolean false
5 Quote the array values boolean true
6 The character used to quote string "

To quote array keys and values with /

associative_implode('=', ' ', $array, true, true, '/');

Returns

'/class/=/class1 class2 class3/ /id/=/elementID/ /data/=/value/'

Credits

License

The MIT License (MIT). Please see License File for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.