PHP Nested Ternary Operator Order

Now let’s say we have the following pseudo-code that we want to implement in several programming language:

bool condition = true;
string text = condition == true ? "A" : condition == false ? "B" : "C";
print text;

Here is the implementation in Javascript:

let st = true;
let text = st === true ? "A": st === false ? "B" : "C";

Here is the implementation in PHP:

$st = true; 
$text = $st === true ? "A": $st === false ? "B" : "C"; 
echo $text;

As a bonus, I also try the same pseudocode in C#:

bool st = true;
string text = (st == true) ? "A" : (st == false) ? "B" : "C";

Now let’s guess what is the result of variable text? The expected value should be A, which is already correct in other languages, but PHP​ produces B. Well, this is not a great discovery but many PHP developers may be missing this after all, so I think it’s worth archiving. Parentheses may fix them but it’s making things ugly, looks like it’s better to stick with if-else statement then.


Conference experience: #tiajkt2017

First and foremost, thank you for Tech in Asia for free #tiajkt2017 conference invitations to my workplace. What an amazing conference. Now let me share some of my experience attending the conference.

It’s so full of visitors

The conference is big, the hall is also big, however there are full of visitors everywhere. Not only from startups, bootstrap alleys, there are also full of academy, investor and general guests everywhere. However I feel bad for bootstrap alley’s long registration queue at the morning, hope it’ll be better next time.

Notes from developer stage

Today I came mainly for attending developer stage. As a programmer myself, the seminar materials are very useful for me. For those who did not attended the conference / stage, here are some notes that I think are important to be known:

Artificial Intelligence are raising in popularity

Artificial Intelligence, with the more specific Machine Learning as subset are gaining popularity in IT industry. Their usage are vast, and will be very useful to (but not limited to):

  • Targeting advertising and marketing
  • Personalization
  • Cut the repetitive workload such as managerial approval and document filling checking
  • Recognizion (face / image, sound, text)

My speculation are that the popularity of big data in recent years enabled companies to do further data mining and lastly the development of artificial intelligence. It’ll be popular and mainstream in next 5-10 years, so make sure to invest your skill in there (me too, need to learn it asap).

Mobile is the king

Unless the startup’s field is in SAAS for administrative B2B systems, their applications will be mobile device oriented. Well then it’s not a wonder that there are rising in demand for ionic, android, angular and react programmers. It’s beneficial for you to learn any of those programming features. And for startup founders, please aware that this is the era of mobile device, and consider to hire those (at least one) who excel at mobile programming.

Metrics are important

For companies and especially for startups, it’s very important to have metrics. Without them, you won’t know how good your progress, and how you measure your lately performance. For startups in specifics, keep dreaming to getting good investors without good metrics.

And make sure your metrics are correct, and aligned with your company’s value. Measuring number of instagram with tag posted won’t be useful for e-commerce startup.

Clouds are rising higher

With the rising in big data and artificial intelligence, the needs for higher spec hardware and workload fluctuation are appearing. Cloud is one of the solutions, that they offer performance scaling in specific time (100% increase in ram for next 24 hours for example). No wonder they are more popular now.

Startup types

I see there are more startups that works in recruitment area. Maybe that’s being inspired with how hard it is to find good programmers. I’m wondering whether they will provide solution (since in reality, good programmers are really scarce). E-commerce startups aren’t many, and most of them are b2b. That’s good. Some ad-hoc service providers startups like plumbers are common too. And uniquely, there are some that trying to work in agricultural area, and one in AI for chatting and socmed marketing. Keep up the good work!


It was an amazing experience. It’s unfortunate that there won’t be any programmers topic at 2nd day though. Maybe TIA can also add IT recruitment segment in their next conference? Lastly I wanna say thank you, and congratulations to Tech in Asia for hosting such amazing conference!

Newbie? Baca ini dulu

“Liburan sebentar lagi nih, iseng-iseng mau belajar programming ah”

“Mau coba cara bikin website e-commerce nih”

“Mau coba pemograman android nih”

Mulai dari mana ya?

Pemula-pemula yang baru mau mulai masuk ke dunia programming / IT biasanya dipenuhi pertanyaan-pertanyaan seperti “bagaimana caranya”, “mulai dari mana”, “cari di mana”, “ada contohnya nggak” dan lain-lainnya. Sementara, sebagian besar programmer berpengalaman, yang sehari-hari kerjaannya nge-google nyari-nyari info dan solusi, rata-rata nggak suka dengan pertanyaan seperti itu. Rata-rata programmer memang harus bisa mandiri dan bisa cari (baca: google) solusi sendiri. Tapi pemula yang nggak ngerti apa-apa juga akan bingung mau cari apa. Maka dari itu, sebelum mulai bertanya ada baiknya baca petunjuk-petunjuk ini dulu: