php tutorial if, php tutorial elseif, php condition statements, php test conditions.php tutorial if, php tutorial elseif, php condition statements, php test conditions.
php tutorial if, php tutorial elseif, php condition statements, php test conditions
php file read tutorial, php file write tutorial, php r/w tutorial, read write tutorial php Online Training

Microsoft Office TrainingMicrosoft Office Skills Training
Business Skills Courses Business Skills Courses

Technical Courses Technical Courses

Networking Networking Training Courses

Java PHP C C++ Perl Training Java PHP C C++ Perl Training

Web Marketing Training Web Marketing Training

Database Training Database Training

Unix Training Unix Training

Online Aptitude Testing and computer Assessments Online Aptitude Testing and Assessments.

Personal Development Training Personal Development Training

Try our online computer training courses via distance learning.
php file read tutorial, php file write tutorial, php r/w tutorial, read write tutorial php Free Video Tutorials

Free video tutorials for Adobe photoshop. Adobe Photoshop
Free video tutorials for Dreamweaver. Dreamweaver
Free video tutorials for Flash. Flash
Free video tutorials for Html. Html
Free video tutorials for visual basic. Visual Basic
Free video tutorials for Perl. Perl
Free video tutorials for C++. C & C++

free IT Training and e-learning computer based training courses.
Online Training Assessments


Technical Courses Verbal Reasoning

aptitude Numerical Reasoning

Free Online Java Quiz

Online Computer Training, e-learning, free video tutorials.
Online Training Training Tools

free IT Training and e-learning courses. Course Manager
Try our online computer training courses and our e-learning cbt courses. System Manager


Computer Training & Webmaster forum - internet marketing and search engine forum
  

Click here to register for your free computer training courses.

Web Diretory | Sitemap | Blog

Try learningsteps.com online computer training courses and tutorial via online learning, online training.

PHP IF / Else Tutorial:


PHP Tutorial IF / Else Statements?

PHP handles If and IF/Else statements similar to all other programming languages.

IF / Else statements are known as Conditional statements and allow you to make choices based on a condition being true or false.

Here is the basic format of If/Else statements in PHP

Example:

<?php
$number = 3;
$firstName = "Fergal";

//evaluate a number
if($number == 3){
	echo " number is 3";
}else {
	echo " number is 4";
}

//evaluate a string
if($firstname == "fred"){
	echo " firstname is fred";
}else{
	echo " firstname is fergal.";
}
?>


The main thing you need to remember is when handling strings you have to include inverted commas.

Ok so now lets look at the code We have created two variables $number and $firstname and we have assigned them some values like below.

<?php
$number = 3;
$firstName = "Fergal";
?>

Next in our if statement we compared a variable to an integer,
- if($number == 3) Note: "==", which in English means "Is Equal To".

What we are saying in real life is if(3 is equal to 3) which evaluates to TRUE then output

number is 3.


Now lets test our string condition

<?php
$firstName = "Fergal";
//evaluate a string
if($firstname == "fred"){
	echo " firstname is fred";
}else{
	echo " firstname is fergal.";
}
?>


The output here is clearly Fergal and $firstname is not equal to fred thus result is FALSE so we execute the else part of statement.
php if else tutorial php if else tutorial
CBT
online computer courses

Copyright ©2007 LearningSteps.com Inc. Computer Based Training | E-Learning | CBT | IT Training

free IT Training and Cbt computer based training courses.

try our paid computer based training(cbt) or free computer training