Re: [PHP-DEV] call_stack

2002-11-27 Thread Phil Dier
On Wed, 27 Nov 2002 15:41:25 +0100 (CET)
Derick Rethans [EMAIL PROTECTED] wrote:

 On Wed, 27 Nov 2002, Miham KEREKES wrote:
 
  Hi!
  
  I'm new to this list, I want to know if there is any function which
  could return the actual call stack, or is it planned to be added?
  It could be very useful (for example in my case, now :-).
 
 debug_backtrace() will be available in PHP 4.3.0 and higher.
 
 Derick
 

I thought debug_backtrace() was a ze2 thing.  Does that mean 4.3 is going to
use ze2?

Phil Dier

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




[PHP-DEV] usort() implementation in 4.1+

2002-07-26 Thread Phil Dier

I'm sure this has been discussed on here already, but I just discovered the usort() 
behaviour that was 
introduced in php 4.1.0 relating to equal values.  Consider this scenario:
?
class data_object
{
var $id;
var $time;
function data_object($id, $time)
{
$this-id = $id;
$this-time = $time;
}
function do_sort($a,$b)
{
if($a-time == $b-time) return 0;
return ($a-time  $b-time) ? 1 : -1;
}
}
$a3 = new data_object(3, 400);
$a2 = new data_object(2, 400);
$a1 = new data_object(1, 400);
$o_array[0] = $a1;
$o_array[1] = $a2;
$o_array[2] = $a3;
echo pre; 
print_r($o_array);  // the array is in the right order here...
echo /pre;
usort($o_array, array(data_object,do_sort));
echo pre;
print_r($o_array);  // here it's apparently in the order it is stored in memory...
echo /pre;
?

There's obviously a couple workarounds in this simple case, but adding more member 
vars and defining 
objects in different places complicates things.  This behaviour is a bug IMO.  And yes 
I saw the note in 
the manual, but i still think this is counter-intuitive and has the chance to break 
people's code (it broke 
mine).

Phil Dier   [EMAIL PROTECTED]
gett communications  http://www.gettcomm.com
gett labs, inc.  http://www.gettlabs.com


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




[PHP-DEV] __CLASS__ and debug_backtrace()

2002-07-10 Thread Phil Dier

While experimenting with php-4.3.0 alpha, i discovered this.  Both __CLASS__ and 
debug_backtrace() 
give the wrong class name in the below program and they do so whether the method is 
called statically 
or on an instance.  Is this a bug or the desired behavour?  If the latter, wouldn't it 
be more useful if it 
gave the child class name?
?

class base
{
function print_something()
{
echo __CLASS__.\n;
print_r(debug_backtrace());
}
}

class child extends base {}

child::print_something();
$c = new child();
$c-print_something();

?

Phil Dier   [EMAIL PROTECTED]
gett communications  http://www.gettcomm.com
gett labs, inc.  http://www.gettlabs.com


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