[html/php]Wierd problem with .php loop

Status
You're currently viewing only svdsinner's posts. Click here to go back to viewing the entire thread.
Not open for further replies.

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
My php script has a loop:
code:<HR>
Code:
while (@${'EqualTo'.$wherecol}[$EqualParm]) {
	$EqualSQL .= ($Text?"'":'').((${'EqualTo'.$wherecol}[$EqualParm]=='EMPTY')?'':${'EqualTo'.$wherecol}[$EqualParm++]).($Text?"'":'').', ';
	}

It works just fine, except anytime I pass data to it where the variable variable IS equal to 'EMPTY', then the whole thing crashes where the browser recieves a "This Page cannot be displayed" error while the php.exe process keeps going and using 5-6% of the CPU until it hits max execution time.

What is wrong with this loop?
 

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
In case this helps any body, the statement is (basically):
code:<HR>
Code:
while (@${[url=http://www.php.net/manual/en/language.variables.variable.phpVariable Variable[/url]}[index]) {
    $variable .= [$url=http://www.php.net/manual/en/language.operators.comparison.php#AEN4593]Working Ternary Operator[/url].[$url=http://www.php.net/manual/en/language.operators.comparison.php#AEN4593]Crashing Ternary Operator[/url].[$url=http://www.php.net/manual/en/language.operators.comparison.php#AEN4593]Working Ternary Operator[/url].', ';
    }

The part that crashes is the middle Ternary operator, and it only crashes if the initial argument = TRUE.

code:<HR>
Code:
((${'EqualTo'.$wherecol}[$EqualParm]=='EMPTY')?'':${'EqualTo'.$wherecol}[$EqualParm++])

Advise?
 
Status
You're currently viewing only svdsinner's posts. Click here to go back to viewing the entire thread.
Not open for further replies.