{"id":21216898,"url":"https://github.com/lablnet/php-arrays","last_synced_at":"2025-10-09T15:23:15.782Z","repository":{"id":57010504,"uuid":"187984853","full_name":"lablnet/PHP-Arrays","owner":"lablnet","description":"A class to manipulate arrays in efficient ways to solve real world problems.","archived":false,"fork":false,"pushed_at":"2019-05-22T08:34:10.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-13T08:47:58.512Z","etag":null,"topics":["algrothm","arrays","class","dataset","fastest","free","manage","php","problemsolving"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lablnet.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-22T07:20:45.000Z","updated_at":"2021-04-18T10:38:47.000Z","dependencies_parsed_at":"2022-08-21T14:50:56.452Z","dependency_job_id":null,"html_url":"https://github.com/lablnet/PHP-Arrays","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lablnet/PHP-Arrays","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FPHP-Arrays","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FPHP-Arrays/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FPHP-Arrays/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FPHP-Arrays/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lablnet","download_url":"https://codeload.github.com/lablnet/PHP-Arrays/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FPHP-Arrays/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001640,"owners_count":26083147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algrothm","arrays","class","dataset","fastest","free","manage","php","problemsolving"],"created_at":"2024-11-20T21:56:09.315Z","updated_at":"2025-10-09T15:23:15.765Z","avatar_url":"https://github.com/lablnet.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n***Note** This package is a part of ZEST Franewrk ([https://github.com/zestframework/Zest_Framework/blob/master/src/Data/Arrays.php](https://github.com/zestframework/Zest_Framework/blob/master/src/Data/Arrays.php)), may thanks to [@peter](https://github.com/peter279k)*\n\nNO PR WILL BE ACCPETED HERE\n\nA class to manipulate arrays in efficient ways to solve real world problems.\n\n\n## Requirement\n\n1.  PHP 7.2 or grater.\n2.  Composer.\n\n## Installation\n\nInstalling this package is very simple, first ensure you have the right PHP version and composer installed then in your terminal/(command prompt) run:\n  `composer require lablnet/arrays`\n\n## Features\n\n 1. Determine whether the given dataSet is really array?\n    - Example:   \n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $arr = array(2, 2, 3, 4, 4, 4, 4, 8, 8, 6, 6, 9, 9, 9, 9); \n        var_dump(Arrays::isReallyArray($arr)); //True\n        var_dump(Arrays::isReallyArray([]));   //False\n        ```\n 2. Determine the given array is (sequential)indexes.?\n    - Example:   \n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $arr = array(2, 2, 3, 4, 4, 4, 4, 8, 8, 6, 6, 9, 9, 9, 9); \n        var_dump(Arrays::isSequential($arr)); //True\n        var_dump(Arrays::isSequential(['a' =\u003e 1]));   //False\n        ```\n\n 3. Determine the given array is assoc.?\n    - Example:   \n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $arr = array(2, 2, 3, 4, 4, 4, 4, 8, 8, 6, 6, 9, 9, 9, 9); \n        var_dump(Arrays::isAssoc($arr)); //False\n        var_dump(Arrays::isAssoc(['a' =\u003e 1]));   //True\n        ```\n\n 4. Determine the given array is multi-dimensional.?\n    - Example:   \n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $arr = array(2, 2, 3, 4, 4, 4, 4, 8, 8, 6, 6, 9, 9, 9, 9); \n        var_dump(Arrays::isMulti($arr)); //False\n        var_dump(Arrays::isMulti(['a' =\u003e ['b' =\u003e 'c']]));   //True\n        ```\n\n 5. Get the type of array.\n    - Example:   \n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $arr = array(2, 2, 3, 4, 4, 4, 4, 8, 8, 6, 6, 9, 9, 9, 9); \n        var_dump(Arrays::getType($arr)); //indexes\n        var_dump(Arrays::getType(['a' =\u003e ['b' =\u003e 'c']]));   //multi\n        ```\n\n6. Add an element to an array using \"operation\" notation if it doesn't exist.\n    - Example:   \n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        var_dump(Arrays::add(['name' =\u003e 'desk', 'price' =\u003e null], 'price', 100)); // ['name' =\u003e 'desk', 'price' =\u003e 100]\n        ```\n\n 7. Set an array item to a given value using \"operator\" notation.\n      - Example:   \n      - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n\t\t$array = ['products' =\u003e ['desk' =\u003e ['price' =\u003e 100]]];\n\t\tArrays::set($array, 'products.desk.price', 200, '.');\n\t\t// ['products' =\u003e ['desk' =\u003e ['price' =\u003e 200]]]\n        ```\n\n8. Get an item from an array using \"operator\" notation(The `Arrays::get` method retrieves a value from a deeply nested array using \"dot\" notation:).\n    - Example:   \n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n\t\t$array = ['products' =\u003e ['desk' =\u003e ['price' =\u003e 100]]];\n\t\t$price = Arrays::get($array, 'products.desk.price', '.');\n\t\t// 100\n        ``` \n  The `Arrays::get` method also accepts a default value, which will be returned if the specific key is not found.\n\n 9. Determine if an item or items exist in an array using 'Operator' notation.\n    - Example:\n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n\t\t$array = ['product' =\u003e ['name' =\u003e 'Desk', 'price' =\u003e 100]];\n\t\t$contains = Arrays::has($array, 'product.name', '.');\n\t\t// true\n\t\t$contains = Arrays::has($array, ['product.price', 'product.discount'], '.');\n\t\t// false\n       ``` \n\n\n10. Determine if an item or items exist in an array using 'Operator' notation.\n    - Example:\n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = ['product' =\u003e ['name' =\u003e 'Desk', 'price' =\u003e 100]];\n        $assoc = Arrays::multiToAssoc($array);\n        // ['name' =\u003e 'Desk', 'price' =\u003e 100]\n       ``` \n\n11. Converted a multi-dimensional associative array with `dot`.\n    - Example:\n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n\t\t$array = ['products' =\u003e ['desk' =\u003e ['price' =\u003e 100]]];\n\t\t$dot= Arrays::dot($array);\n\t\t// ['products.desk.price' =\u003e 100]\n       ``` \n\n12. Converted a multi-dimensional associative array with `operator`.\n    - Example:\n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n\t\t$array = ['products' =\u003e ['desk' =\u003e ['price' =\u003e 100]]];\n\t\t$dot = Arrays::multiToAssocWithSpecificOpr($array);\n\t\t// ['products.desk.price' =\u003e 100]\n       ``` \n\n13. Push an item onto the beginning of an array.\n    - Example:\n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = ['red', 'green', 'blue'];\n        $prepend = Arrays::prepend($array, 'yellow');\n        // ['yellow', 'red', 'green', 'blue'];\n       ``` \n\n14. Push an item to the end of array.\n    - Example:\n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = ['red', 'green', 'blue'];\n        $append = Arrays::append($array, 'yellow');\n        // ['red', 'green', 'blue', 'yellow'];\n       ``` \n\n15. Get the unique elements from arrays.\n    - Example:\n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = ['red', 'green', 'blue', 'red'];\n        $unique = Arrays::append($array);\n        // ['red', green', 'blue'];\n       ``` \n\n16. Get a subset of the items from the given array.\n    - Example:\n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array =  [\n            'users' =\u003e \n            [\n                'id' =\u003e 1,\n                'name' =\u003e \"Alex\",\n                'username' =\u003e 'peter',\n            ],\n            [\n                'id' =\u003e 2,\n                'name' =\u003e \"Peter Khot\",\n                'username' =\u003e 'peter',\n            ],\n            [\n                'id' =\u003e 3,\n                'name' =\u003e \"John\",\n                'username' =\u003e 'test',\n            ]\n        ];\n        $subSetOfArray = Arrays::subSetOfArray($array, 'name');\n        // [];\n       ``` \n\n17. Remove one or many array items from a given array using \"operator\" notation.\n    - Example:\n    - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n\t\t$array = ['products' =\u003e ['desk' =\u003e ['price' =\u003e 100]]];\n\t\tArrays::forget($array, 'products.desk');\n\t\t// ['products' =\u003e []]\n\t\t```\n\n18. Get all of the given array except for a specified array of keys.\n    - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n\t\t$array = ['name' =\u003e 'Desk', 'price' =\u003e 100]\n\t\t$filtered = Arrays::except($array, ['price']);\n\t\t// ['name' =\u003e 'Desk']\n\t\t```\n\n19. Get a value from the array, and remove it.\n     - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n\t\t$array = ['name' =\u003e 'Desk', 'price' =\u003e 100];\n\t\t$name = Arrays::pull($array, 'name');\n\t\t// $array: ['price' =\u003e 100]\n\t\t```\n\n20. Changes the case of all keys in an array.\n     - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = ['name' =\u003e 'Desk', 'price' =\u003e 100];\n        $name = Arrays::arrayChangeCaseKey($array, CASE_UPPER);\n        // ['NAME' =\u003e 'Desk', 'PRICE' =\u003e 100]\n        ```\n  \n 21. Changes the case of all values in an array.\n     - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = ['name' =\u003e 'Alex'];\n        $name = Arrays::arrayChangeCaseValue($array, CASE_UPPER);\n        // ['name' =\u003e 'ALEX']\n        ```\n\n22. Remove duplicate values from array.\n     - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = ````\n        $name = Arrays::removeDuplicates($array);\n        // $array: ['red', 'green', 'blue']\n        ```\n\n\n23. Get the most occurring value from array.\n     - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = ['red', 'blue', 'green', 'red', 'blue'];\n        $name = Arrays::mostOccurring($array);\n        // ['red', 'blue']\n        ```\n\n24. Get the least occurring value from array.\n     - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = ['red', 'blue', 'green', 'red', 'blue'];\n        $name = Arrays::leastOccurring($array);\n        // ['green']\n        ```\n\n25. Convert the array into a query string.\n     - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = [\n            'foo' =\u003e 'bar',\n            'baz' =\u003e 'boom',\n            'cow' =\u003e 'milk',\n            'php' =\u003e 'hypertext processor'\n        ];\n        $name = Arrays::query($array);\n        // foo=bar\u0026baz=boom\u0026cow=milk\u0026php=hypertext+processor\n        ```\n\n\n26. Filter the array using the given callback (THIS METION WILL NOT WORKS WITH MULTIDIMESSIONAL ARRAY.).\n     - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = [100, '200', 300, '400', 500];\n        $array = Arrays::where($array, function ($value, $key) {\n            return is_string($value);\n        });\n        // [1 =\u003e '200', 3 =\u003e '400']\n        ```\n\n27. Get one or a specified number of random values from an array.\n     - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = ['red', 'green', 'blue'];\n        $name = Arrays::random($array);\n        // ['blue'];\n        ```\n\n 28. Get multiple values of same keys from multi-dimessional array.\n     - Example:\n     - ```php\n        use Lablnet\\Arrays;\n        require '../vendor/autoload.php';\n        $array = [\n            ['developer' =\u003e ['id' =\u003e 1, 'name' =\u003e 'Alex']],\n            ['developer' =\u003e ['id' =\u003e 2, 'name' =\u003e 'Peter']],\n        ];\n        $name = Arrays::pluck($array, 'name');\n        // ['Alex', 'Peter'];\n        ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flablnet%2Fphp-arrays","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flablnet%2Fphp-arrays","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flablnet%2Fphp-arrays/lists"}