473,382 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Check for infinite loop?

I suspect there might be an infinite loop in my code, however, php
seems to timeout and continue running the script. Is there a way to
check for this?

Oct 20 '05 #1
4 3707
el*************@yahoo.com wrote:
I suspect there might be an infinite loop in my code, however, php
seems to timeout and continue running the script. Is there a way to
check for this?


With vi:

/for
o
print "I'm in the first loop!<br />";
/
o
print "I'm in the second loop<br />";
(repeat until it wraps)
/while
o
print "I'm in the first while loop!<br />";
/
o
print "I'm in the scond while loop<br />";

etc.
C.

Oct 20 '05 #2
On 20 Oct 2005 08:45:10 -0700, el*************@yahoo.com wrote:
I suspect there might be an infinite loop in my code, however, php
seems to timeout and continue running the script. Is there a way to
check for this?


http://en.wikipedia.org/wiki/Halting_problem
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Oct 20 '05 #3
el*************@yahoo.com wrote:
I suspect there might be an infinite loop in my code, however, php
seems to timeout and continue running the script. Is there a way to
check for this?


Possibly with profiler or debugger <http://in.php.net/APD>

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Oct 21 '05 #4

el*************@yahoo.com wrote:
I suspect there might be an infinite loop in my code, however, php
seems to timeout and continue running the script. Is there a way to
check for this?


I traced the problem to several calls to http requests like:

$contents = file('http://www.mydomain.com/some_variable');

Each one could took upto a second so I got rid of all but one . I
suppose there is a lot of overhead with making the http request through
php?

Oct 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: Gremlin | last post by:
If you are not familiar with the halting problem, I will not go into it in detail but it states that it is impossible to write a program that can tell if a loop is infinite or not. This is a...
5
by: mailpitches | last post by:
Hello, Is there any way to kill a Javascript infinite loop in Safari without force-quitting the browser? MP
4
by: LOPEZ GARCIA DE LOMANA, ADRIAN | last post by:
Hi all, I have a question with some code I'm writting: def main(): if option == 1: function_a()
16
by: Brian Tkatch | last post by:
Is there a way to check the order in which SET INTEGRITY needs to be applied? This would be for a script with a dynamic list of TABLEs. B.
44
by: James Watt | last post by:
can anyone tell me how to do an infinite loop in C/C++, please ? this is not a homework question .
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.