Functional approach in PHP

The code snippet below will only work in PHP-5.3+!. Isn’t it the famous functional programming with functions as first class citizens, closures and other functional bla-bla? <?php> function one($a = 0) { return function(callable $b) use ($a) { return call_user_func($b, $a); }; } print_r(call_user_func(one(1), function ($x) { return $x + 4; } )); This was created just for fun. As you may see, in place of callable you can put any valid PHP callable, e.g.in a form ['Class', 'method'] ...

October 19, 2016 · 1 min · rodush

How to change PHPMyAdmin session timeout

By default, the session lifetime in a new PhpMyAdmin installation using the “cookie”; authentication method is 1440 seconds (24 minutes). That is, after 24 minutes of inactivity, the next request will take the user to the login page. To increase the session lifetime, set the value of the variable to say, 60x longer: $cfg['LoginCookieValidity'] = 1440 * 60; // 86400 means one day (24-hours)

March 27, 2011 · 1 min · rodush