PHP For Loop

When you need to do the same script many times, for exemple you want to send emails to all your users, you don't need to write a php code for each user, you just need to use for Loop which will do it for each one.
This is how:
for ($userid=1;$userid<=10;$userid++){

Where send_email() is your own function that send the email to the user with the id as parameter.

Another exemple to For Loop, let's say you want to count 1+2x2+3x3+...+nxn, this is how you can do it:
for ($i=1;$i<=$n;$i++){
$t+=$i*$i; // the same as $t=$t+$i*$i

So how For loop works ?

1. Set a counter variable to some initial value (i.e $i=0).
2. Check to see if the conditional statement is true(i.e $i<=10).
3. Execute the code within the loop.
4. Increment a counter at the end of each iteration through the loop(i.e $i++, or $i+=1, ou $i=$i+1) .

And this is how to do it:
for ( initialize a counter; conditional statement; increment a counter){
do this code;

The php loop will help you a lot in php programming, and there are other ways to do loops other that For, like while.


Custom-Web-design said...

Great work...if you can give another example then it would be more easy to understand.

Cegonsoft said...

It's a nice example..

Jack said...

Quite worthwhile info, thank you for the article.
sex in office | cast aluminum | Toronto condos

rize wordpress said...

Our dedicated PHP Programmers have an appropriate mix of expertise and ability that gives you the choice to select most suitable professional/team for your project.

jaring safety said...

The article posted was very informative and useful
thanks for sharing.
jaring futsal , jaring futsal murah , jual jaring futsal , toko jaring futsal , agen jaring futsal ,
jaring golf , jual jaring golf , jaring golf murah , jaring polynet , tangga darurat , jaring truk ,
jaring cargo , jaring outbound , jual rumput futsal murah , jual rumput sintetis murah , tali tambang , cargo net ,
jaring tanaman , jaring kassa , jaring proyek , jaring bangunan , jaring gedung , jaring pengaman proyek ,
jaring pengaman bangunan , jaring pengaman gedung , jaring peneduh , jaring waring , kasa hijau , tangga darurat ,
jaring gawang futsal , jaring peneduh , jaring truk

Sathya G said...

this is really a very great blog. the information present in this blog will be very useful for us. thank you for sharing with us.
ROI Services in Chennai

Rahul Kumar said...

This is the best blog design and article. Very nice job. Thank you very much
Your design and pics of the blog is really nice.

php training

Pasang Iklan Gratis said...

It's really useful for me, thanks a lot.

Jeffy said...

Thank you for sharing such a nice and interesting blog with us. Hope it might be much useful for us. keep on updating...!!
seo company in india
digital marketing company in india
seo company in chennai
digital marketing company in chennai

kokila zenrays said...

Thanks for this informative blog. Good information about PHP loop. keep sharing nice blog. Best PHP training in Bangalore

Garrick Co Ida said...

PHP Training in Chennai
PHP Online Training India

Aptron said...

It's a nice example of PHP loop and that's a important part of PHP Course.

iClass Gyansetu said...

Salesforce Admin Certification Training Gurgaon,Delhi

Ancy merina said...

I like this blog, saved to my bookmarks.I have got some important suggestions from it.
Web Development Services in Bangalore
Website Design and Development Services in Bangalore
ECommerce Web Design Company in India
Outsource magento ecommerce services india

Saravanan said...

Language Interpretation Services, Voice Over Services India

Ram priya said...

I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog. 
Data science training in tambaram
Data science training in kalyan nagar
Data Science training in OMR
Data Science training in anna nagar
Data Science training in chennai
Data Science training in marathahalli
Data Science training in BTM layout
Data Science training in rajaji nagar

Nila shri said...

It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...

Deops training in annanagar

Devops training in chennai

Devops training in marathahalli

Devops training in rajajinagar

Devops training in BTM Layout

nivatha said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops training in Chennai
Devops training in Bangalore
Devops training in Pune
Devops Online training
Devops training in Pune
Devops training in Bangalore
Devops training in tambaram

simbu said...

I simply want to give you a huge thumbs up for the great info you have got here on this post.

java training in chennai | java training in bangalore

java online training | java training in pune

selenium training in chennai

selenium training in bangalore

Rohini .R said...

Nice post. By reading your blog, i get inspired and this provides some useful information. Thank you for posting this exclusive post for our vision.
Selenium Training in Chennai | Selenium Training in Bangalore | Selenium Training in Pune | Selenium online Training

pragya pragya said...

I'm here representing the visitors and readers of your own website say many thanks for many remarkable
python training in tambaram
python training in annanagar
python training in jayanagar

SRI said...

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

rpa interview questions and answers
automation anywhere interview questions and answers
blueprism interview questions and answers
uipath interview questions and answers
rpa training in chennai

Anonymous said...

This is good site and nice point of view.I learnt lots of useful information.
angularjs online Training

angularjs Training in marathahalli

angularjs interview questions and answers

angularjs Training in bangalore

angularjs Training in bangalore

angularjs Training in chennai

mounika said...

Nice post..

salesforce training in btm

salesforce admin training in btm

salesforce developer training in btm

asha said...

Nice Article
devops course in bangalore

best devops training in bangalore

Devops certification training in bangalore

devops training in bangalore

devops training institute in bangalore

manisha said...

" I enjoy what you guys are usually up too. This sort of clever work and coverage! Keep up the wonderful works guys I’ve added you guys to my blog roll.
iWatch service center chennai | apple ipad service center in chennai | apple iphone service center in chennai | Apple laptop service center in chennai

manisha said...

"Hello! Someone in my Facebook group shared this website with us, so I came to give it a look. I’m enjoying the information. I’m bookmarking and will be tweeting this to my followers! Wonderful blog and amazing design and style.
iWatch service center chennai | apple ipad service center in chennai | apple iphone service center in chennai

manisha said...

" I’d love to be a part of group where I can get advice from other experienced people that share the same interest. If you have any recommendations, please let me know. Thank you.
apple service center chennai | Mac service center in chennai | ipod service center in chennai | Apple laptop service center in chennai

Jvimala said...

Very Clear Explanation. Thank you to share this
Best Devops Training in Chennai | Best Devops Training Institute in Chennai

OLIVIA H said...

Your lessons have been very insightful and fun!
Acer service centre in Chennai | acer mobile service center in chennai | acer laptop service center in chennai | acer laptop service center in chennai | Acer service centre in Chennai | acer services in chennai | Acer service centre in Chennai | acer laptop service center in chennai

Blogger said...

Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
Devops Training in Chennai | Devops Training Institute in Chennai

Segmentweb Industries said...

I really like your posts. Amazing job. Thanks for providing this post.
Web Design Services Jaipur | Web Design Company Jaipur
Logo Design Services Jaipur | Logo Design Company Jaipur

yashnit said...

Thanks For Sharing The Information The Information Shared Is Very Valuable Please Keep Updating Us Time Just Went On Reading The article Python Online Course Hadoop Online Course Aws Online Course Data Science Online Course