When you run the crontab script, it swears at the function below. Gives an error message -
PHP Parse error: syntax error, unexpected '[' in "
the line $params = array_merge([$value], array_slice( $args, 2, func_num_args() ) ) ;
function array_group_by( array $array, $key ){ if ( ! is_string( $key ) && ! is_int( $key ) && ! is_float( $key ) && ! is_callable( $key ) ) { trigger_error( 'array_group_by(): The key should be a string, an integer, or a callback', E_USER_ERROR ); return null; } $func = ( is_callable( $key ) ? $key : null ); $_key = $key; // Load the new array, splitting by the target key $grouped = array(); foreach ( $array as $value ) { if ( is_callable( $func ) ) { $key = call_user_func( $func, $value ); } elseif ( is_object( $value ) && isset( $value->{ $_key } ) ) { $key = $value->{ $_key }; } elseif ( isset( $value[ $_key ] ) ) { $key = $value[ $_key ]; } else { continue; } $grouped[ $key ][] = $value; } // Recursively build a nested grouping if more parameters are supplied // Each grouped array value is grouped according to the next sequential key if ( func_num_args() > 2 ) { $args = func_get_args(); foreach ( $grouped as $key => $value ) { $params = array_merge([$value], array_slice( $args, 2, func_num_args() ) ); $grouped[ $key ] = call_user_func_array( 'array_group_by', $params ); } } return $grouped; }
[$value]toarray($value)- teran