Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

group array by key value #94

Open
obonyojimmy opened this issue May 3, 2016 · 0 comments
Open

group array by key value #94

obonyojimmy opened this issue May 3, 2016 · 0 comments

Comments

@obonyojimmy
Copy link

I tried using the group array helper/method as below :

*The array *

 mainarray => [
 0 => array [
    "value" => "option1"
    "placeholder" => ""
    "text" => ""
    "name" => "optionsRadios"
    "id" => ""
    "class" => ""
    "label" => "Option Three  "
  ]
  1 =>  [
    "value" => "option2"
    "placeholder" => ""
    "text" => ""
    "name" => "optionsRadios"
    "id" => ""
    "class" => ""
    "label" => "Option Three  "
  ]
  2 =>  [
    "value" => "option3"
    "placeholder" => ""
    "text" => ""
    "name" => "optionsRadios"
    "id" => ""
    "class" => ""
    "label" => "Option Three  "
  ]
]

function

Arrays::group($mainarray, function($value) {
 return $value['name'] == 'optionsRadios'; // test key value
})

i keep getting error , how would i achive this ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant