{"action":"created","issue":{"url":"https://api.github.com/repos/jakezatecky/array_group_by/issues/1","repository_url":"https://api.github.com/repos/jakezatecky/array_group_by","labels_url":"https://api.github.com/repos/jakezatecky/array_group_by/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/jakezatecky/array_group_by/issues/1/comments","events_url":"https://api.github.com/repos/jakezatecky/array_group_by/issues/1/events","html_url":"https://github.com/jakezatecky/array_group_by/issues/1","id":177104044,"number":1,"title":"does not work on php 5.3 here is a proposed solution ","user":{"login":"sidd-kishan","id":1007208,"avatar_url":"https://avatars.githubusercontent.com/u/1007208?v=3","gravatar_id":"","url":"https://api.github.com/users/sidd-kishan","html_url":"https://github.com/sidd-kishan","followers_url":"https://api.github.com/users/sidd-kishan/followers","following_url":"https://api.github.com/users/sidd-kishan/following{/other_user}","gists_url":"https://api.github.com/users/sidd-kishan/gists{/gist_id}","starred_url":"https://api.github.com/users/sidd-kishan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sidd-kishan/subscriptions","organizations_url":"https://api.github.com/users/sidd-kishan/orgs","repos_url":"https://api.github.com/users/sidd-kishan/repos","events_url":"https://api.github.com/users/sidd-kishan/events{/privacy}","received_events_url":"https://api.github.com/users/sidd-kishan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-15T07:02:07Z","updated_at":"2016-09-16T00:27:05Z","closed_at":"2016-09-16T00:27:05Z","body":"function fn_array_group_by( array $array, $key )\r\n\t{\r\n\t\tif ( ! is_string( $key ) && ! is_int( $key ) && ! is_float( $key ) && ! is_callable( $key ) ) {\r\n\t\t\ttrigger_error( 'fn_array_group_by(): The key should be a string, an integer, or a callback', E_USER_ERROR );\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\t$func = ( is_callable( $key ) ? $key : null );\r\n\t\t$_key = $key;\r\n\t\t// Load the new array, splitting by the target key\r\n\t\t$grouped = array();\r\n\t\tforeach ( $array as $value ) {\r\n\t\t\tif ( is_callable( $func ) ) {\r\n\t\t\t\t$key = call_user_func( $func, $value );\r\n\t\t\t} elseif ( is_object( $value ) && isset( $value->{ $_key } ) ) {\r\n\t\t\t\t$key = $value->{ $_key };\r\n\t\t\t} elseif ( isset( $value[ $_key ] ) ) {\r\n\t\t\t\t$key = $value[ $_key ];\r\n\t\t\t} else {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\t$grouped[ $key ][] = $value;\r\n\t\t}\r\n\t\t// Recursively build a nested grouping if more parameters are supplied\r\n\t\t// Each grouped array value is grouped according to the next sequential key\r\n\t\tif ( func_num_args() > 2 ) {\r\n\t\t\t$args = func_get_args();\r\n\t\t\tforeach ( $grouped as $key => $value ) {\r\n\t\t\t\t$params = array_merge( array( $value), array_slice( $args, 2, func_num_args() ) );\r\n\t\t\t\t$grouped[ $key ] = call_user_func_array( 'fn_array_group_by', $params );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $grouped;\r\n\t}\r\n/*\r\nit is beacuse of the $grouped = [];\r\nand \r\narray_merge( [$value], array_slice( $args, 2, func_num_args() ) );\r\nwhich is cahnged to \r\narray_merge( array( $value), array_slice( $args, 2, func_num_args() ) );\r\n*/"},"comment":{"url":"https://api.github.com/repos/jakezatecky/array_group_by/issues/comments/247490730","html_url":"https://github.com/jakezatecky/array_group_by/issues/1#issuecomment-247490730","issue_url":"https://api.github.com/repos/jakezatecky/array_group_by/issues/1","id":247490730,"user":{"login":"jakezatecky","id":3210703,"avatar_url":"https://avatars.githubusercontent.com/u/3210703?v=3","gravatar_id":"","url":"https://api.github.com/users/jakezatecky","html_url":"https://github.com/jakezatecky","followers_url":"https://api.github.com/users/jakezatecky/followers","following_url":"https://api.github.com/users/jakezatecky/following{/other_user}","gists_url":"https://api.github.com/users/jakezatecky/gists{/gist_id}","starred_url":"https://api.github.com/users/jakezatecky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakezatecky/subscriptions","organizations_url":"https://api.github.com/users/jakezatecky/orgs","repos_url":"https://api.github.com/users/jakezatecky/repos","events_url":"https://api.github.com/users/jakezatecky/events{/privacy}","received_events_url":"https://api.github.com/users/jakezatecky/received_events","type":"User","site_admin":false},"created_at":"2016-09-16T00:27:05Z","updated_at":"2016-09-16T00:27:05Z","body":"Hey there --\r\n\r\nPHP 5.3 was end of life'd in [2014](https://secure.php.net/eol.php) and I generally do not want to support versions that even the core developers do not want to support. I also think the 5.4 array syntax is much more elegant.\r\n\r\nA previous version of the library did support PHP 5.3, but it was [explicitly removed] (565b375ea7346ff49097b34b0f30e5c069434c7e). You are free to use v0.7.3 if you want support for 5.3:\r\n\r\nhttps://github.com/jakezatecky/array_group_by/tree/0.7.3\r\n\r\n"}}
{"actor":{"display_login":"jakezatecky"}}