The Ternary Operator in PHP

If you already know few operators of PHP , You must be knowing “if” operator , “else” operator and “elseif” So here i come to point . How do we write a statement that need to take decision among two values and it has a condition . Generally it is : if expression statement1 else expression2 so  it not only becomes long . Along with this it becomes hectic ….

Read more

Loop Counter using For Loop

Are you curious how many loops run when a “for” Loop is executed ? Here is an example . <?php for ($loop_counter = 0; $loop_counter < 7; $loop_counter++){ echo “You are going to see this message 7 times.<br>”; } ?> Here is the Result of Above Example . What will happen if you do not add  $loop_counter at end of condition ? It will certainly do not stop the loop…

Read more

Know “Switch” Statement in PHP

So now  if you have already finished with if , elseif and Ternary operator , Let Codexpert make you more pro of PHP . Switch Statement  Let me tell you how it works . When you Pass a value (  integer , floating point numbers or string ) to the switch statement and then switch statement checks it against all cases . If any of the value matches the condition…

Read more