Showing posts with label Echo Statement. Show all posts
Showing posts with label Echo Statement. Show all posts

Monday, 17 February 2014

if_if else Statement in php

php if else statement
if else Statement in php
This is tutorial of “if statement” within php. Now, “if statement” is to compare data’s and parameters or to evaluate something which is true or false,thus fulfills the true condition.For example If i do this that will be outcome and if i don’t do this that will be outcome.

Code for if_if else statement (Screenshot1):-


if else statement in php
if _ if else Statement (Screenshot 1)
<?php

if (1)
{
echo ' TRUE.';
}
else
{
echo 'FALSE.';
}
?>


Output (Screenshot2) :-

if_if else statement in php
Screenshot2
In this code of “if and else statement”, code will be evaluated that are inside the curly {} brackets.I have echoed “True” when value is 1.In general, 1 itself is a statement of programming that will evaluate “True” as an echo statement,otherwise it will follow “elsestatement” that will echo “False” as an echo statement if wechange value 1 to any number 

Code for if_if else statement(Screenshot3) :-

If else Statement Screenshot3
<?php
if (0)
{
echo ' TRUE.';
}

else
{
echo 'FALSE.';
}
?>


Output (Screenshot4) :-

If else in php
Screenshot4
In this example we are changing value 1 to 0. 0 itself is a statementof programming that will output “False”. 

Code for if_if else Statement (Screenshot5) :-

Code for if_else statement in php
Screenshot5
<?php
If (true)
{
echo ' TRUE.';
}
else
{

echo 'FALSE.';
}


?>

Output (Screenshot6) :-

if else php
Screenshot6

In this example we are doing the same thing by changing variables to true values. Its evaluate “True” and echoes it. 

Code for if_if else Statement (Screenshot7) :-

if_else if statement
Screenshot7
<?php
if (false)
{
echo ' TRUE.';
}
else
{
echo 'FALSE.';
}
?>

Output (Screenshot8) :-

else if statement
Screenshot8
In this example we are doing the same thing by changing variables to false values. Its evaluate “False” and echoes it. If “if_else statements” are used for comparison,then comparison operator such as double equal to (==) in if statement is used as shown below. 

 Code for if_if else statement with operators (Screenshot9) :-

 Code for if_if else statement with operators
 Code for if_if else statement with operators (Screenshot9) :-

<?php
if (1==1)
{
echo ' TRUE.';
}
else
{
echo 'FALSE.';
}
?>

Output (Screenshot10):-

else statement php
Screenshot10

In this code we say 1 is equal to 1 which is true so it will echo out “True”. 

Code for if_if else statement with operators and variables(Screenshot11) :-

variables in if else statement
Screenshot11


<?php
$text = 'Something';
if ($text=='Something')
{
echo 'TRUE.';
}
else
{
echo 'FALSE.';
}
?>


output (Screenshot12):-

if else statement
Screenshot12
In this example of code we are taking varibles “if statement” we aredefining variables and in different condition we are putting variables to compare and check which are true statements and which are false statements.

 Code for if_if else statement with operators and variables(Screenshot13) :-

if else statement
Screenshot13

<?php
$text = 'Something';
if ($text=='Something else')
{
echo 'TRUE.';
}
else
{
echo 'FALSE.';
}
?>

output (Screenshot14):-

if else statement
Screenshot14
In this example of “if statement” we declare variable $text as “Something” which will echo out “False”. Here, the “if statement” fulfills “Something else” and echoes “True” but in actual value is not “Something else” its “Something”.So this the basic structure of “if_else statement”.We can use if_else statement with keywords of if and else quiet easily! !
Read More

Tuesday, 11 February 2014

Echo Statement in php


Echo statement
Echo Statement
Echo Statement php programming Languages. This is a tutorial about Echo Statement. Echo Statement is not function. In php the two basic constructs to get output are echo and print. print statement will see in next tutorial. Echo is language constructs within php that allows us to output data string to the user browser. Its allows us to output basically on the screen.

Echo Statement code (Screenshot) :-


echo statement
Echo Statement
<?php

echo 'Hello world';

?>
In screenshot is the example for how we can use echo statement and the output screenshot. Now we can also use html tags in php for example

Output (screenshot):-

Echo Statement
Output Echo Statement



In example of code we had echo statement after echo we can use single quotation mark(‘) or double quotation mark(”) and you will learn about this when, why and where you should use quotation marks. Basically Double quotation mark allows you to output variables inside program before that you should know what are variables are. But this tutorial is about echo i am not going in so detail later on this will explain in detail. and semi colon (;) is used to end of the line in echo statement and also separator for two echo statements used one by another otherwise we can get some errors for example see Screenshot1 and Screenshot2.

echo statement
Screenshot1

echo statement
Screenshot2


html tags in php code (screenshot 5) :-

html tags in php
Screenshot5



<?php

echo "<strong>Hello world.</strong>";

?>
output screenshot 6:-

Echo Statement
Screenshot6
In this example you had idea how we can use html tags in php. And also Echo statement uses for echoing output to the browser.
Read More

About Me

Welcome to Extra Tutorials! My name is Mohammed and I am the 22 year writer, website developer, and photographer behind the blog. Thanks for visiting! Tutorials Jackpot… In addition to Developer, I love to develop websites and I love to write. Starting a php Blog was inevitable for me. What began as a simple way to share all of my Tutorials with friends and family has developed into my Part time job.

Mohammed Padela

WHAT IS PHP PROGRAMMING

WHAT IS PHP PROGRAMMING
WHAT IS PHP PROGRAMMING

Follow Us

Popular Posts

Designed ByBlogger Templates