Jump to content

PRIME OR NOT


srinivasa

Recommended Posts

Here i have attached a file name prime.php ,basically am reading input from a form and check whether no is prime or not....there is problem with code, its really working well for small nos upto 10(user input),if user enter above 10 like 11,100...its showing the following error

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\prime.php on line 25

 

Kindly i request you to have a look at code, n suggest me solution.

prime.php

Link to comment
Share on other sites

Here i have attached a file name prime.php ,basically am reading input from a form and check whether no is prime or not....there is problem with code, its really working well for small nos upto 10(user input),if user enter above 10 like 11,100...its showing the following error

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\prime.php on line 25

 

Kindly i request you to have a look at code, n suggest me solution.

 

 

It's because it takes PHP more than 30 seconds to reach and check that number, and as the maximum excecution time for a script is set to 30 seconds the code is terminated before it gets there. One way is to bumbp the time up in your php.ini config file; check for the maximum excecution time limit.

 

Or as these types of stuff really aren't suited for doing using php parser a long with the the browser approach. I would suggest you install php as a shell extension, that way you can run it in the terminal/command prompt instead and not having to mind the maximum excecution time.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...