Skip to content

How to get complete current url for Cakephp

How do you echo out current URL in Cake’s view? Answer You can do either From a view file: Which will give you the absolute url from the hostname i.e. /controller/action/params Or which should give you the full url with the hostname.

Replace spaces around hyphens with nbsp

I’m in need of (probably) regexp (or two) to do following: replace every space after any single letter word with   I found this question, however, if there’s word with apostrophe (like there’s), previous regexp ‘thinks’ that the ‘s’ after the apostrophe is si…

How to run array_filter recursively in a PHP array?

Given the following array $mm When I run count(array_filter($mm)) I get 3 as result since it is not recursive. count(array_filter($mm), COUNT_RECURSIVE) also will not do because I actually need to run the array_filter recursively, and then count its result. So my question is: how do I recursively run array_fi…

Help converting vBulletin 3.6.4 to phpBB 3

So I’ve been researching, and it looks like converters only exist from vBulletin 3.x to phpBB 2.0 and then from phpBB 2.0 to 3.0 I would rather not do a two-step conversion, but I don’t want to do a …

Search Array : array_filter vs loop

I am really new in PHP and need a suggestion about array search. If I want to search for an element inside a multidimensional array, I can either use array_filter or I can loop through the array and see if an element matching my criteria is present. I see both suggestion at many places. Which is faster? Below…