I'm just testing the waters here...If anyone interested in more let me know
please.
simple do/for loop
The Do
The For
PHP
please.
simple do/for loop
The Do
PHP Code:
dow count < 11;
// in this do loop we will be writing 10 records in
// a subfile
mysubfilefield1 = 'test data';
RRN+=1;
write SUB01;
count +=1;
enddo;
PHP Code:
for count = 1 to 10;
// in this do loop we will be writing 10 records in
// a subfile
mysubfilefield1 = 'test data';
RRN+=1;
write SUB01;
enddo;
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?
// same comment id "//" as free RPG
// this will write a header line 6 times
// because there are only 6 header sizes <h1>,<h2>,<h3>,<h4>,<h5>,<h6>
// notice the "." after the "This is header" this is for concatenating of
// the test and the variable counter..(Variables are identified by the "$")
// see attached image for output
// there are three "expressions in the for loop
// 1= initialization expression
// 2= conditional expression (in our case do while less than 7)
// 3= re-initialize expression we used $counter++
// same as ($counter = $counter + 1)
// to decrement we would have said:
// for ($counter = 6; $counter > 0 ; $counter--)
// you can leave out the conditional and the PHP loop would just run & run & run & run
// you get the point.... ;)
for ($counter = 1; $counter < 7; $counter++)
{
$number++;
print "<h$counter>";
print "This is header" .$number . "<br>" ;
print "</h$counter>";
}
?>
</body>
</html>
Comment