Re: bubble sort crashing apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Josh Howe wrote:

> function that is crashing apache.

Seems soo unlikely. What do you mean exactly by this?
PHP doing infinte loop?

private function sort() {

Why not simply use the std sort function? Dont reinvent the wheel http://www.php.net/manual/en/function.sort.php

> 		if ($val2 > $val1)
> 			return true;
> 		else
> 			return false;

With bools, simply use

	return $val2 > $val1;

if ($this->order_dir == "desc") {
if ($val2 > $val1)
return true;
else return false;
} else {
if ($val1 > $val2)
return true;
else return false;
}

Can be simply written like this (I think it's more readable)

	return ($this->order_dir == "desc") ? $val2 > $val1 : $val1 > $val2

Christophe

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux