[nycphp-talk] PHP 5.3 Problem - Object Creation problem

Jeff Siegel jeffmailings99 at
Tue Aug 21 10:21:35 EDT 2007


Thank you! That worked like a charm!


-----Original Message-----
From: talk-bounces at [mailto:talk-bounces at]On
Behalf Of Jake McGraw
Sent: Tuesday, August 21, 2007 10:01 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] PHP 5.3 Problem - Object Creation problem

Create a public __toString() function within your Database class. It can be
something as simple as:

public function __toString() {
  return 'Object';

This is a new as of 5.2 - for some reason they've removed implicit
object-to-string conversion. You must provide explicit __toString if you're
printing or concatenating your objects.

- jake

More information about the talk mailing list