Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

alternative to is_integer 1

Status
Not open for further replies.

CliveC

Programmer
Nov 21, 2001
1,222
US
The intention of the code below is to print out the division (for a page break) every 100 lines.
I can't seem to find a way to do it as is_integer still considers $lines as floating point.

Can anyone offer a suggestion.

Code:
for ($i=0; $i<$count; $i=$i+10) {
//SOME OK CODE
  $lines=(float)$i/100.00;
  if (!is_integer($lines)) {
     echo('<div class=\"page\">');
  }
//SOME OK CODE
}

Clive
 
How about using modulus (%)?
Code:
$lines = $i % 100;
if($lines == 0) {
  echo('<div class="page">');
}

I don't think you need to backslash double quotes inside single quotes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top