Connecting Tech Pros Worldwide Help | Site Map

Question of PHP-4 vs PHP-5

  #1  
Old May 11th, 2006, 09:25 PM
tony@tony.com
Guest
 
Posts: n/a

When debugging the blowfish utility I noticed that

$bf = new Crypt_Blowfish($mykey);
echo("BF: " . $bf");

Outputs the word "OBJECT" on a PHP-4 linux system

and "OBJECT id #1" on a windoze PHP-5 system

Can anyone confirm this is correct and even better -
explain what the output of each is please
(I dont understand PHP classes yet)

tks

tony
  #2  
Old May 11th, 2006, 10:15 PM
Colin McKinnon
Guest
 
Posts: n/a

re: Question of PHP-4 vs PHP-5


tony@tony.com wrote:
[color=blue]
>
> When debugging the blowfish utility I noticed that
>
> $bf = new Crypt_Blowfish($mykey);
> echo("BF: " . $bf");
>
> Outputs the word "OBJECT" on a PHP-4 linux system
>
> and "OBJECT id #1" on a windoze PHP-5 system
>
> Can anyone confirm this is correct and even better -
> explain what the output of each is please
> (I dont understand PHP classes yet)[/color]

Yes, both are correct, but the question is wrong - if you want to describe
an object then give it a method to describe itself. If you want to see
inside an object then use the var_export() fn.

The difference is related to the change in how objects are referenced in the
different PHP versions.

C.
  #3  
Old May 11th, 2006, 11:25 PM
Chung Leong
Guest
 
Posts: n/a

re: Question of PHP-4 vs PHP-5



tony@tony.com wrote:[color=blue]
> When debugging the blowfish utility I noticed that
>
> $bf = new Crypt_Blowfish($mykey);
> echo("BF: " . $bf");
>
> Outputs the word "OBJECT" on a PHP-4 linux system
>
> and "OBJECT id #1" on a windoze PHP-5 system
>
> Can anyone confirm this is correct and even better -
> explain what the output of each is please
> (I dont understand PHP classes yet)[/color]

The "Object ..." string is the result of PHP converting an object to a
string. The id # in PHP5 is a new feature. Internally, the Zend 2
engine keeps track of all objects in an array. An object's id is its
place within that array.

The object id is useful for debugging purpose. It also give you a way
to use objects as keys to a hash table.

  #4  
Old May 12th, 2006, 02:05 AM
tony@tony.com
Guest
 
Posts: n/a

re: Question of PHP-4 vs PHP-5


In article <2MN8g.18665$mX1.5242@newsfe2-gui.ntli.net>,
colin.thisisnotmysurname@ntlworld.de...ssUR aBot.com says...[color=blue]
> tony@tony.com wrote:
>[color=green]
> >
> > When debugging the blowfish utility I noticed that
> >
> > $bf = new Crypt_Blowfish($mykey);
> > echo("BF: " . $bf");
> >
> > Outputs the word "OBJECT" on a PHP-4 linux system
> >
> > and "OBJECT id #1" on a windoze PHP-5 system
> >
> > Can anyone confirm this is correct and even better -
> > explain what the output of each is please
> > (I dont understand PHP classes yet)[/color]
>
> Yes, both are correct, but the question is wrong - if you want to describe
> an object then give it a method to describe itself. If you want to see
> inside an object then use the var_export() fn.
>
> The difference is related to the change in how objects are referenced in the
> different PHP versions.
>
> C.
>[/color]

Thats good to know thanks.

tony
  #5  
Old May 12th, 2006, 02:05 AM
tony@tony.com
Guest
 
Posts: n/a

re: Question of PHP-4 vs PHP-5


In article <1147385803.897554.68210@g10g2000cwb.googlegroups. com>,
chernyshevsky@hotmail.com says...[color=blue]
>
> tony@tony.com wrote:[color=green]
> > When debugging the blowfish utility I noticed that
> >
> > $bf = new Crypt_Blowfish($mykey);
> > echo("BF: " . $bf");
> >
> > Outputs the word "OBJECT" on a PHP-4 linux system
> >
> > and "OBJECT id #1" on a windoze PHP-5 system
> >
> > Can anyone confirm this is correct and even better -
> > explain what the output of each is please
> > (I dont understand PHP classes yet)[/color]
>
> The "Object ..." string is the result of PHP converting an object to a
> string. The id # in PHP5 is a new feature. Internally, the Zend 2
> engine keeps track of all objects in an array. An object's id is its
> place within that array.
>
> The object id is useful for debugging purpose. It also give you a way
> to use objects as keys to a hash table.
>
>[/color]
Aha - thanks Chung - that makes more sense to me now.
(I really must make time to get into classes soon - but thats the
catch 22 I guess - do I make time or just keep working !)

tony



Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Performance of lots of ECHO's V Jumping In/Out of PHP M answers 10 November 11th, 2006 07:05 AM
Is there a way to verify integrity of php/javascript code Han answers 23 September 26th, 2005 04:35 AM
problems getting valid HTML out of PHP lawrence answers 5 July 17th, 2005 09:40 AM
Needs help with old PHP scrips on new server with update version of PHP laurie answers 3 July 17th, 2005 03:25 AM
Question of PHP strategizerating Alexander Ross answers 1 July 16th, 2005 11:47 PM