How to shuffle dynamic object of associative array to get to this combination - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, May 20, 2023

How to shuffle dynamic object of associative array to get to this combination

how to shuffle multiple associative array objects to get to this combinations ?

I have this objects here enter image description here

I want t get to this combination enter image description here

foreach($placeHolders2 as $key => $value) {
    foreach($value as $key2 => $value2) {
        for($i=0 ; $i< count(collect($value2)); $i++) {
            info($value2[$i]);
        }
    }
} 

the code above gives this

the data is something like this :

[2023-05-18 15:01:24] local.INFO: array (
  0 => 
  array (
    'name' => 'shapes',
    'values' => 
    array (
      0 => '🔴',
      1 => '🟩',
      2 => '🔺',
    ),
  ),
  1 => 
  array (
    'name' => 'hearts',
    'values' => 
    array (
      0 => '❤',
      1 => '💛',
      2 => '💙',
    ),
  ),
  2 => 
  array (
    'name' => 'fruits',
    'values' => 
    array (
      0 => '🍌',
      1 => '🍎',
      2 => '🍒',
    ),
  ),
)  


source https://stackoverflow.com/questions/76282122/how-to-shuffle-dynamic-object-of-associative-array-to-get-to-this-combination

No comments:

Post a Comment