PHP RFC: Comprehensions

Another interesting RFC recently landed to PHP community. So far the easiest way of explaining comprehensions for me comes from Python world:

Comprehensions are constructs that allow sequences to be built from other sequences.

Here’re some examples from List comprehensions in Python:

def palindromes(strings):
    return [s + s[::-1] for s in strings]

def starting_with(letter, names):
    return [name for name in names if name[0].lower() == letter.lower()]

JavaScript, however, decided to remove its support from standard in favour of filter/arrow/map functions.

The array comprehensions syntax is non-standard and removed starting with Firefox 58. For future-facing usages, consider using Array.prototype.mapArray.prototype.filterarrow functions, and spread syntax.


Speaking of PHP RFC, that’s what we might get if RFC gets approved:

$gen = [for $list as $x if $x % 2 yield $x*2];

//equivalent to:

$gen = (function() use ($list) {
  foreach ($list as $x) {
    If ($x % 2) {
     yield $x * 2;

Personally, I would vote in favour of this. Maybe, it’s nostalgia about Perl one-liners and how elegant you can solve some basic stuff. I think PHP needs this syntactic sugar, giving people choice of using closure calls and comprehensions.

Disney to compete with Netflix

Disney executives didn’t mention Netflix once during their three-hour-plus investor presentation Thursday, at which the company laid out its plans to build up a suite of subscription streaming services — most notably Disney+, a $7-a-month service bursting with movies and TV shows. Disney+ launches in the US in November and will feature everything from Disney’s recent theatrical offerings, like Captain Marvel, to classic Disney movies like Bambi, and new, original stuff like The Mandalorian, a Star Wars TV-show spinoff.


“First they ignore you, then they laugh at you, then they fight you, then you win”. (c) Gandhi

Rumours: Facebook brings back Messenger to App

FastCompany recently posted some rumours on possible integration of FB Messenger back to Facebook app:

Until 2014, Facebook users were able to send and receive Facebook messages in the primary app. But then Facebook decided to remove the messaging feature from the app and forced users to use the dedicated Facebook Messenger app to send and receive Facebook messages.

Wong speculates that the reversal of this policy is in preparation of Facebook integrating its messaging services across all its apps: Messenger, WhatsApp, and Instagram..


Seems that, a number of people who removed FB app from mobiles, is larger than presented on the media. It’s quiet some time since I removed FB app from my mobile, due to its constant irrelevant notifications. Less than a month ago, I gave Facebook another try. It lasted few days till I deleted it again.

I still occasionally use it through the browser, but not the app:

  • UI/UX got overwhelmed with stuff I don’t use
  • Content level reduced drastically
  • All the data leaks didn’t help bringing the trust to the brand

Most of the valuable content slowly migrated to messengers, some of which belong to Facebook, but yet again, if FB will bring Messenger back to its mobile app, it’d be easier to cross this app out as well, and move to WhatsApp/Telegram alternatives.

SPA reload after deploy

John Resig, founder of jQuery, recently raised a great discussion on how to handle Single Page Application reloading after deployment.

Some of the options included:

  • Pass build version with each Ajax response and reload if mismatched.
  • Send a version hash to a server and force 412 code if versions not matching.
  • Notification on version update to leave refresh up to user to decide.
  • Client version passed in HTTP header to check for updates.
  • Log out all the clients at midnight
  • Turning on the servers only from 9 till 5.

Scotland Trip – 2017

Note: It appeared that this post was hanging in the drafts for almost a year. Only a year after, going through all the articles, that I kept aside for publishing, I finally decided to get this one in.

Island escape

Living in Cyprus for almost half of my life, whenever I was choosing the destination for vacations, my wife and I were picking the places that had to follow:

  • Lack of sun (those who lives on the sunny island will get what I mean)
  • Sightseeings that weren’t demolished by Punic Wars or anything that happened before Christ death.
  • Cultural shift
  • Transportation

Mediterranean Europe: why not?

April is a lovely time to travel around Southern Europe. It’s still not too crowded by tourists, the sun won’t melt you on the spot. Italy, Spain, Greece – lovely countries to visit.

But one of the things that these places have in common – is slow relaxed culture, that pretty much the same we have in Cyprus. That’s what you might want to escape for a week or two, when you need to rewire your brain on vacation.

Going North – Scotland

I’ll be honest with you, one of the crucial reasons, of choosing Scotland over other Central/Northern European countries for the holiday’s trip – was the fact that my brother already settled down there for studies. As It matched all the points from the requirements list, we picked the travel dates and bought the tickets.

And in about a week, we landed in Edinburgh with the plan of staying there for a week, with a short visit to Aberdeen to pick my brother for Easter vacations, and head back to Cyprus.

Edinburgh, here we go!

Going anywhere abroad, you can be sure, that you will meet someone who’s connected to Cyprus by any means. The very thing happened to us, without even leaving Edinburgh airport. An officer on the passport control, seeing our documents, was mind blown.

– Flying from Cyprus to Scotland, in April?! I surved in Nicosia for 3 years in the UN troops. It’s lovely sunny place!
– That’s one of the reasons we choose Edinburgh, as we haven’t seen rains for almost a year!
– Well, you’re in the right place! Welcome to Scotland!

30 minutes drive from the airport, and we arrived to lovely A-Haven Town House hotel built in Victorian period in Newhaven area. The hotel is located in 10 minutes walk from old centre of the town.

A-Haven TownHouse Hotel

Unlike Cyprus, most of sightseeing in Scotland dates in AD epoch. We were lucky of staying for a week in this lovely town and visit most of the major tourist places without repeating even once.

You can easily lose yourself in the town centre among various monuments, and other cultural heritage buildings. Throughout the week we managed to check:

The weather was favourable for us, it was raining only twice during the night. So we managed to catch up with most of the places we could reach during the day.

Heading North to Aberdeen

By the end of the journey we went to granite city of Scotland – Aberdeen. A lovely small town, centre of oil & gas industry of Scotland. And one of the biggest student cities of the North.

After 2 hours on the train from Waverley Station we got to Aberdeen.

University of Aberdeen was found in 1495, which currently hosts around 14000 students from around the globe.

Unfortunately, we didn’t have much time to explore the city. We managed to visit the university campus and the down town. Due to its industrial/student vibe, the city was less crowded with wandering tourists. Nevertheless, Aderdeen left positive impressions of great hospitality, solid beautiful architecture.

Back to Cyprus

Recalling the trip to Scotland, I would say that it was a memorable experience. It was filled with hospitality, great places, excellent food. Edinburgh definitely has its charm, that makes you want to go back and explore the city even more.

Hopefully, next time we manage to get to the West coast of Scotland, Glasgow and castles of Skye islands.