Categories
Coding and Logic

When comparing two arrays (in PHP), what is the difference between == and === ?

Wish happy independence day to all Indians.

I have not posted anything since a long time. I thought to break the silence with this small post.

I was appearing for a skill test in Advanced PHP. I scored 82% (though I was expecting to get 90%), but I am upset as the percentile is just 72%. During the skill test, I found many tricky questions. But I am discussing about this particular thing, as I did not found anyone discussing this on the Internet.

Categories
Coding and Logic

Playing with Switches

While coding, you need to control over something, so we have “Control Structures” in our language. Most of the programing language have control structures. And you are building an application, so you (not you exactly, your code) need to make a decision, then your code start comparing things and take the correct decision and moves ahead. It uses conditional statements for comparing stuffs and take action as per the logic. When we say conditional statements, normally some people understand if, else stuff. And they just ignore the switch statement. In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. But I have seen some people using long series of else if/elseif instead using switch. Here I am going to discuss few tricks with the Switches (switch statement).