{"id":23092655,"url":"https://github.com/kjdev/php-ext-callmap","last_synced_at":"2026-02-05T09:41:48.397Z","repository":{"id":8100461,"uuid":"9515253","full_name":"kjdev/php-ext-callmap","owner":"kjdev","description":"Call a callback with an map of parameters function Extension for PHP","archived":false,"fork":false,"pushed_at":"2013-05-03T07:36:44.000Z","size":252,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T23:56:30.084Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kjdev.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":"2013-04-18T06:41:23.000Z","updated_at":"2022-09-10T03:40:53.000Z","dependencies_parsed_at":"2022-07-17T14:47:14.075Z","dependency_job_id":null,"html_url":"https://github.com/kjdev/php-ext-callmap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjdev%2Fphp-ext-callmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjdev%2Fphp-ext-callmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjdev%2Fphp-ext-callmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjdev%2Fphp-ext-callmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kjdev","download_url":"https://codeload.github.com/kjdev/php-ext-callmap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251801180,"owners_count":21645968,"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","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":[],"created_at":"2024-12-16T21:35:36.425Z","updated_at":"2026-02-05T09:41:48.329Z","avatar_url":"https://github.com/kjdev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Call a callback with an map of parameters function Extension for PHP\n\n[![Build Status](https://travis-ci.org/kjdev/php-ext-callmap.png?branch=master)](https://travis-ci.org/kjdev/php-ext-callmap)\n\nThis extension allows call a callback with an map of parameters function.\n\n## Build\n\n    % phpize\n    % ./configure\n    % make\n    $ make install\n\n## Configration\n\ncallmap.ini:\n\n    extension=callmap.so\n\n    callmap.override_call_user_func_array=0      ; PHP_INI_SYSTEM\n    callmap.override_forward_static_call_array=0 ; PHP_INI_SYSTEM\n\n### callmap.override\\_call\\_user\\_func\\_array _bool_\n\nOverride to call\\_user\\_func\\_map the call\\_user\\_func\\_array function.\n\n### callmap.override\\_forward\\_static\\_call\\_array _bool_\n\nOverride to forward\\_static\\_call\\_map the forward\\_static\\_call\\_array function.\n\n\n## Function\n\n* call\\_user\\_func\\_map — Call a callback with an map of parameters\n* forward\\_static\\_call\\_map — Call a static method and pass the arguments as map\n\n## call\\_user\\_func\\_map — Call a callback with an map of parameters\n\n### Description\n\nmixed **call\\_user\\_func\\_map** ( callable _$callback_ , array _$params_ )\n\nCalls the callback given by the first parameter with the parameters in params.\n\n### Parameters\n\n* _callback_\n\n  The callable to be called.\n\n* _params_\n\n  The parameters to be passed to the callback, as an indexed map.\n\n### Return Values\n\nReturns the return value of the callback, or FALSE on error.\n\n\n## forward\\_static\\_call\\_map — Call a static method and pass the arguments as map\n\n### Description\n\nmixed **forward\\_static\\_call\\_map** ( callable _$callback_ , array _$params_ )\n\nCalls a user defined function or method given by the function parameter.\n\n### Parameters\n\n* _callback_\n\n  The callable to be called.\n\n* _params_\n\n  The parameters to be passed to the callback, as an indexed map.\n\n### Return Values\n\nReturns the return value of the callback, or FALSE on error.\n\n\n## Examples\n\n    function add($a, $b) {\n        return $a + $b;\n    }\n    function sub($c, $d) {\n        return $c - $d;\n    }\n    call_user_func_map('add', ['a' =\u003e 3, 'b' =\u003e 5, 'c' =\u003e 7, 'd' =\u003e 11]);\n    // int(8)\n    call_user_func_map('sub', ['a' =\u003e 3, 'b' =\u003e 5, 'c' =\u003e 7, 'd' =\u003e 11]);\n    // int(-4)\n\n### Example #1\n\n    function test($a, $b, $c, $d) {\n        //$a -- 'A'\n        //$b -- 'B'\n        //$c -- 'C'\n        //$d -- 'D'\n    }\n    call_user_func_map('test', array('d' =\u003e 'D', 'a' =\u003e 'A', 'c' =\u003e 'C', 'b' =\u003e 'B'));\n\n![Example 1](docs/example_01.png)\n\n### Example #2\n\n    function test($a, $b, $c, $d) {\n        //$a -- 'A'\n        //$b -- 'D'\n        //$c -- 'C'\n        //$d -- 'B'\n    }\n    call_user_func_map('test', array('D', 'a' =\u003e 'A', 'c' =\u003e 'C', 'B'));\n\n![Example 2](docs/example_02.png)\n\n### Example #3\n\n    function test($a, $b, $c, $d) {\n        //$a -- 'A'\n        //$b -- NULL\n        //$c -- 'C'\n        //$d -- ?\n    }\n    call_user_func_map('test', array('a' =\u003e 'A', 'c' =\u003e 'C'));\n\n![Example 3](docs/example_03.png)\n\n### Example #4\n\n    function test($a = '1', $b = '2', $c = '3', $d = '4') {\n        //$a -- 'A'\n        //$b -- '2' //version 0.2.0 or newer (0.1.0 is NULL)\n        //$c -- 'C'\n        //$d -- '4'\n    }\n    call_user_func_map('test', array('a' =\u003e 'A', 'c' =\u003e 'C'));\n\n![Example 4](docs/example_04.png)\n\n### Example #5\n\ncallmap.ini (callmap.override\\_call\\_user\\_func\\_array=1)\n\n    var_dump(ini_get('callmap.override_call_user_func_array')); //bool(true)\n\n    function test($a, $b) {\n        return $a . $b;\n    }\n    $res1 = call_user_func_array('test', array('b' =\u003e '2', 'a' =\u003e '1'));\n    $res2 = call_user_func_map('test', array('b' =\u003e '2', 'a' =\u003e '1'));\n\n    var_dump($res1 === $res2); //bool(true)\n\n## Related\n\n* [code coverage report](http://gcov.at-ninja.jp.2-t.jp/D)\n* [api document](http://api.at-ninja.jp.2-t.jp/E)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjdev%2Fphp-ext-callmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkjdev%2Fphp-ext-callmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjdev%2Fphp-ext-callmap/lists"}