Re: [PHP] PHP4 vs PHP5 classes

2008-07-29 Thread Robert Cummings
On Wed, 2008-07-30 at 01:16 -0500, Larry Garfield wrote: > On Wednesday 30 July 2008 12:44:46 am Robert Cummings wrote: > > > It's unfortunate that PHP5 decided to throw a Strict Standards exception > > when you include both style constructors. For instance, I'm certain at > > one point the follow

Re: [PHP] PHP4 vs PHP5 classes

2008-07-29 Thread Larry Garfield
On Wednesday 30 July 2008 12:44:46 am Robert Cummings wrote: > It's unfortunate that PHP5 decided to throw a Strict Standards exception > when you include both style constructors. For instance, I'm certain at > one point the following was recommended: > > class Foo > { > function __construct(

Re: [PHP] PHP4 vs PHP5 classes

2008-07-29 Thread Robert Cummings
On Tue, 2008-07-29 at 22:26 -0700, Jim Lucas wrote: > Chris wrote: > >> Don't forget that in PHP5, the constructor named has changed. In PHP4 > >> it called a method with the same name as the class. But, in PHP5, it > >> looks for __construct() instead. > > > > If __construct doesn't exist then

Re: [PHP] PHP4 vs PHP5 classes

2008-07-29 Thread Jim Lucas
Chris wrote: Don't forget that in PHP5, the constructor named has changed. In PHP4 it called a method with the same name as the class. But, in PHP5, it looks for __construct() instead. If __construct doesn't exist then it falls back to the php4 way - makes it backwards compatible :) But, i

Re: [PHP] PHP4 vs PHP5 classes

2008-07-29 Thread Chris
> Don't forget that in PHP5, the constructor named has changed. In PHP4 > it called a method with the same name as the class. But, in PHP5, it > looks for __construct() instead. If __construct doesn't exist then it falls back to the php4 way - makes it backwards compatible :) -- Postgresql &

Re: [PHP] PHP4 vs PHP5 classes

2008-07-29 Thread Jim Lucas
[EMAIL PROTECTED] wrote: Maybe setting $this->max should be done in fetchSelectData since that's what is causing/creating your loop. Thanks Chris, I copied the code into the fetchSelectData function and it seems to be working fine now! Just need to test removing the code from the constructor

Re: [PHP] PHP4 vs PHP5 classes

2008-07-29 Thread Chris
[EMAIL PROTECTED] wrote: >>> The $players object is created before the loop: >>> $players = new Players($lid); >> >> >> Which means the code is only executed once since it's in the >> constructor. It's not changing per loop because you're not calling the >> code. >> >> Maybe setting $this->max sho

Re: [PHP] PHP4 vs PHP5 classes

2008-07-29 Thread jeff . mills
> Maybe setting $this->max should be done in > > fetchSelectData > > since that's what is causing/creating your loop. > Thanks Chris, I copied the code into the fetchSelectData function and it seems to be working fine now! Just need to test removing the code from the constructor to make sure its

Re: [PHP] PHP4 vs PHP5 classes

2008-07-28 Thread jeff . mills
>> >> The $players object is created before the loop: >> $players = new Players($lid); > > > > Which means the code is only executed once since it's in the > constructor. It's not changing per loop because you're not calling the > code. > > Maybe setting $this->max should be done in > > fetchSele

Re: [PHP] PHP4 vs PHP5 classes

2008-07-28 Thread Chris
[EMAIL PROTECTED] wrote: >> Since the Players method is a constructor, it's more about how you set >> the object(s) up. >> >> What does the loop look like before you create a new object? >> > > Well see here is where it gets messy! This is not my code - I've ported a > phpnuke module over to drago

Re: [PHP] PHP4 vs PHP5 classes

2008-07-28 Thread jeff . mills
> > Since the Players method is a constructor, it's more about how you set > the object(s) up. > > What does the loop look like before you create a new object? > Well see here is where it gets messy! This is not my code - I've ported a phpnuke module over to dragonflycms. The $players object is

Re: [PHP] PHP4 vs PHP5 classes

2008-07-28 Thread Chris
> I have run through the script with a debugger, and sure > enough, we only enter function Players once. > > Is this normal behaviour for PHP5 vs PHP4? > Is there a way for me to force $this->max to be calculated each time > function max is called? Since the Players method is a constructor, it's