PHP -Building Blocks

If –else statements:

if…else statement – executes set of codes if a condition is true and another code if the condition is false

Within a statement, if a certain condition is true, then something happens. Otherwise, something else happens. We can continue adding else statements as many times as we need.

So, within PHP statement, we first define the variable and then set up the conditional statements like this:

Syntax:

if (condition)

code to be executed if condition is true;

elseif (condition)

code to be executed if condition is true;

else

code to be executed if condition is false;

Example 1:

<?php

$avg = 50

if ($avg>60)

{

echo “You have a good score”;

}

else

{

echo “Score is less than average”;

}

?>

Example 2: 

<?php

$status = 1;

if ($status== 1)

{

print (“<img src =images/right.jpg>”);

}

else

{

print (“<img src =images/cross.jpg>”);

}

?>

The variable called $status has been assigned a value of 1.The first line of if statement tests to see what is inside of the variable called $status. It‘s testing to see whether this variable has a value of 1.

About Us

Luckily friends do ashamed to do suppose. Tried meant mr smile so. Exquisite behaviour as to middleton perfectly. Chicken no wishing waiting am. Say concerns dwelling graceful.

Services

Most Recent Posts

  • All Post
  • advanced-excel-training
  • Branding
  • deepti saini model
  • Development
  • Digital Marketing
  • digital marketing course gurgaon
  • Digital Marketing Internship Gurugram
  • digital marketing jobs
  • digital-marketing-institutes-sector-14
  • Leadership
  • Management
  • Notice
  • php-development-courses
  • php-full-stack-development-courses
  • php-job-opportunity
  • php-training
  • php-training-in-baksar
  • php-training-in-balia
  • php-training-in-bangalore
  • php-training-in-delhi
  • php-training-in-faridabad
  • php-training-in-gaziabad
  • php-training-in-gorakhpur
  • php-training-in-gurgaon
  • php-training-in-kolkata
  • php-training-in-muzaffarpur
  • php-training-in-noida
  • php-training-in-patna
  • placements
  • web development training gurgaon

Company Info

She wholly fat who window extent either formal. Removing welcomed.

Limited Seats Available – Register Now

We keep batch sizes limited so every learner gets personal attention and proper doubt solving. Reserve your seat now and start your training in the next batch without delay. For details call us +91- 8802000175

Help

Privacy Policy

Terms

Conditions

Subscribe Now

For latest news and updates, fill your details below-

You have been successfully Subscribed! Ops! Something went wrong, please try again.
© 2023 Created with Royal Elementor Addons