PHP 7 cool new features

Hello all,

Today, I thought to give you a quick run through about cool new features in PHP 7. PHP 7 has been there for sometime but it is still worth paying some closer look at what it has to offer to the world of PHP development. In this post I will be giving few examples which are exclusively to PHP 7 and onwards. Please note that at the time I write this post PHP 7.2.5 is available to download.

Scalar type declarations

Type declaration tells the type of the arguments needs to be passed when calling a function. Available scalar types are class, self, callable, array, int, string, float, boolean and iterable. (The latter five was introduced as part of PHP 7).

declare(strict_types=1);
function getTotal(int ...$ints)
{
return array_sum($ints);
}

var_dump(getTotal(45, 85, 134));

The above will give you this,

int(264)

With the strict_types enabled if you call the same function by passing mixed type parameters like this,

var_dump(getTotal("45", '8', 134.4));

This will give you a TypeError,

Fatal error: Uncaught TypeError: Argument 1 passed to getTotal() must be of the type integer, string given, Next TypeError: Argument 2 passed to getTotal() must be of the type integer, string given, Next TypeError: Argument 3 passed to getTotal() must be of the type integer, float given. 

For additional information, the declaration of strict type is per file basis and it will affect function parameter types as well as function return types. Continue reading

Share

Gumball3000, London UK 2016

Hi folks,

How are you all doing? Last week, I got an opportunity to witness some hot, sports cars in Gumball3000. Gumball3000 was held on 2nd May 2016 (Bank Holiday) at Regent Street, Central London. That was quite fun and there were a plethora of expensive sports cars roaming through the Regent Street. I got some pictures during the event and I would like to share those images with you. Some of these images were taken by @gtiranda. Thanks Iranda for those images. Enjoy my PhotoBucket album below 🙂

Last but not least, I got my eyes lucky enough to see my childhood hero David Hasselhoff during Gumball3000 and here is the video that I have recorded 🙂

The official Gumball3000 URL :- https://gumball3000.com/

Cheers!

Share

Must watch video for Software designers/developers

A person is going to meet his grandfather who is dying, so he could spend last few moments with his grandfather and tell how much he loves him. That person uses a Bus application to check for the bus time table and notices that there is a bus coming in 2 minutes which is going that way. He runs to the closest bus station and waits for 15 minutes for the bus to arrive but nothing comes. Then he gets a SMS saying that his grandfather just passed away. If he could’ve known that the bus is going to be delayed, he should have used a taxi instead of waiting for the bus. What actually happened was that Bus application has lied to him by providing wrong information. The delay has never been reflected in the Bus application.

Moral of the story: – Even though we design/develop intangible things called software/application, we must think more humanly and respect humanism. So as software designers/ developers we have a great responsibility towards the entire humanity. Hope you guys will agree with me . Don’t you?

Share

Happy New Year!

Happy New Year!!!

Trust me, this year is going to be a much promising one.

Stay tuned 🙂

Cheers!!

Share

Little bit busy, sorry :(

Hey friends, sorry I have been very much busy past couple of months and unfortunately my busy schedule seems to follow for another month or so. But trust me, after that I will be in more touch with you guys.

Meantime feel free to follow me via Facebook and Twitter.

Have a happy time!

May the noble triple gem bless you all!

AJ

Share