php tutorial loops, php tutorial while loops, php tutorial For loops.php tutorial loops, php tutorial while loops, php tutorial For loops.
php tutorial loops, php tutorial while loops, php tutorial For loops
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 Tutorial LOOPs:


PHP For LOOP and While LOOP Tutorial.

In PHP loops are known as control structures and used as a method of removing iterative tasks. When i say iterative i mean you don't have to copy and paste your code many times.

Example:

<?php

echo "page hits = 1";
echo "page hits = 2";
echo "page hits = 3";
echo "page hits = 4";

?>


To alleviate this problem you can you a simple for loop or a while loop.

FOR LOOPS:

Example:

<?php
for ($i=1;$i<=4;$i++){   echo " $i ";}
   echo "page hits = $i
"; } ?>

The output from this piece of code would be

page hits = 1 page hits = 2 page hits = 3 page hits = 4

As you can see clearly using loops makes our task much easier and less repetitive. Now let's look at the code.

In For loops you will notice that the first line of our code contains three conditions.
$i=1;$i<=4;$i++

Now lets look at each one

$i=1; - This is known as the initial expression, the stating point for our loop i.e start at 1.

$i<=4;- This is known as the condition test, in here we tests the current status to determine if the loop should happen or not.

$i++ - This is known as the closing expression in our loop, it updates our loop variable.


What's happening :

1. The variable $i starts with a 1 value.

2. The condition test checks if $i has a value less than or = to

3. If the value is less than or equal to 4, do the loop. If the value is false greater than 4, skip out of the loop.

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