Hi all. Hope you read yesterdays article there i give some work to you. Here the code for the same

Printing 1 – 10

1
2
3
4
5
6
<?php 
          //Code for printing a statement
		  for($i=1;$i<11;$i++){
          	echo $i." ";
		  }
		  ?>

Printing 10 – 1

1
2
3
4
5
6
<?php 
          //Code for printing a statement
		  for($i=10;$i>0;$i--){
          	echo $i." ";
		  }
		  ?>

odd numbers

1
2
3
4
5
6
7
8
<?php 
          //Code for printing a statement
		   for($i=1;$i<11;$i++){
			  if($i%2 == 1){
          		echo $i." ";
			  }
		  }
		  ?>

Even numbers

1
2
3
4
5
6
7
8
<?php 
          //Code for printing a statement
		   for($i=1;$i<11;$i++){
			  if($i%2 == 0){
          		echo $i." ";
			  }
		  }
		  ?>

Hope it is clear to every one. we can move to next section.I just introduced some PHP codes in front of you. We can begin with developing a site. together with this we can learn php codes.We can begin that learning from next class onwards

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *

4 + 3 =