Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8449999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:51:14+00:00 2026-06-10T10:51:14+00:00

I have got a strange problem.This is my code: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML

  • 0

I have got a strange problem.This is my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
$fp=fopen("test.txt","w",true);
if($fp)
{
$start=time();
for($i=0;$i<=17800;$i++)
{
    fwrite($fp,"bandwith");
}
fclose($fp);
$stop=time();
$diff=round($stop-$start,2);
$fsize=round(filesize("test.txt")/1024,2);
$bandwidth=$fsize/$diff;
echo "<strong>The speed of your broadband is</strong> ".$bandwidth;
}
else
{
    echo ("problem with permission");
}
?>

</body>
</html>

I am actually trying to calculate the bandwidth.The error I get is “Division by zero” on the $bandwidth calculation part.The strange part is that when I keep on refreshing the window I suddenly get the answer then again the problem comes during the next refresh.

Extra info:

I found out that the error occurs when the $start and $stop are same.Now my question is:Is localhost so damn fast to finish the text file opening and writing part within the same time resulting in division my zero error?I also checked the text file and it contains the data and it is deleted and written every other time.I just want a clear explanation of the reason behind it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:51:16+00:00Added an answer on June 10, 2026 at 10:51 am

    If you need a more accurate time calculation, and your system supports it, you can use microtime:

    $time_including_microseconds = microtime();
    

    See the example in the manual about exploding it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got this strange problem using py-amqp and the Flopsy module. I have written
I've got a very strange problem recently. I have a code which processes inApp
I have this code in the __constructor $this->Reliability = new Reliability(name,url); Problem: I got
I have got something strange: This Code does NOT Work: cell.imvstatus.image = [UIImage imageNamed:[[tutorials
Today I got a really strange problem. Try to execute this C# code: class
I have a strange problem this time. I've got a masking database setup that
I've got a strange problem with templates and namespaces... I have the following code
Ok, I've got a strange problem. I am testing a usercontrol and have code
I have got this strange problem.XSL is not working with xml.This is my xml
I have got a strange problem about in_array recently which I cannot understand. e.g.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.