Sometimes you need to create an emtpy branch, especially for GitHub’s project pages. Below you will find the most simple solutin I’ve found so far.
Call_user_func_struct
Wrapper function hack for call_user_func_array
which enables you to use keyword arguments on PHP functions and methods. It aims to be as close as possible to the behavior of call_user_func_array
.
Messing Around With PHP’s Late Static Binding
Some weird PHP behavior I stumbled over while debugging our software. This is known at least since 2009 (https://bugs.php.net/bug.php?id=50031). Maybe this opens a few new possibilities for dependency injection or nasty hacks.
Determine the Type of a PHP Array
PHP’s arrays are a mix of dictionaries and lists (i. e. in Python).
Sometimes you have to determine if an array is a list:
1
|
|
or a dictionary:
1 2 3 4 |
|
Unfortunately PHP has no built-in method to do so. One of the good solutions I’ve ran across is to use the array_filter()
on the array’s keys to determine if they’re all integers:
Making Zend Di and ServiceManager Run Standalone
Setting up the Zend Framework 2 DiC and ServiceManager inside a ZF2 MVC application is done by the framework, you will only have to write your configuration array.
If you plan to use this components standalone, i. e. in your own software, you will not find one word about how to achieve this goal.