Shortcode multiple values

you can make a string and parse it. you start with

[foo people="name:john,age:51|name:jenny,age:62" something="custom"]

and you use this code

add_shortcode("foo", function ($attr, $content, $tag) {


    // parsing attributes

    $attr["people"] = explode("|", $attr["people"]);

    $attr["people"] = array_map(function ($e) {

        $tab = [];

        foreach (explode(",", $e) as $raw_tab) {
            $tab2 = explode(":", $raw_tab);
            $tab[$tab2[0]] = $tab2[1];
        }


        return $tab;

    }, $attr["people"]);


    /*

    $attr = array(
        'people' => array(
            0 => array(
                'name' => 'john',
                'age' => '51',
            ),
            1 => array(
                'name' => 'jenny',
                'age' => '62',
            ),
        ),
        'something' => 'custom',
    );

    */


    // generate output

    $result = "...";


    return $result;

});