l-x.github.io

Call_user_func_struct

| Comments

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.

Determine the Type of a PHP Array

| Comments

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
array('foo', 'bar', 'baz');

or a dictionary:

1
2
3
4
array(
  'foo'   => 'bar',
  'herp'  => 'derp'
);

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

| Comments

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.