Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23055 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36268 invoked by uid 1010); 30 Apr 2006 18:27:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 36253 invoked from network); 30 Apr 2006 18:27:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2006 18:27:04 -0000 X-PHP-List-Original-Sender: bfoz@bfoz.net X-Host-Fingerprint: 204.127.200.84 sccrmhc14.comcast.net NetCache Data OnTap 5.x Received: from ([204.127.200.84:64929] helo=sccrmhc14.comcast.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 07/EC-18514-87105544 for ; Sun, 30 Apr 2006 14:27:04 -0400 Received: from [192.168.0.5] (c-24-6-134-233.hsd1.ca.comcast.net[24.6.134.233]) by comcast.net (sccrmhc14) with ESMTP id <20060430182700014002111fe>; Sun, 30 Apr 2006 18:27:00 +0000 Message-ID: <44550173.9000701@bfoz.net> Date: Sun, 30 Apr 2006 11:26:59 -0700 User-Agent: Thunderbird 1.5 (X11/20060401) MIME-Version: 1.0 To: Wez Furlong CC: internals@lists.php.net References: <445447FB.5060306@bfoz.net> <4e89b4260604300631j6f855a59wc008cc320ff8f48f@mail.gmail.com> In-Reply-To: <4e89b4260604300631j6f855a59wc008cc320ff8f48f@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] resources vs objects? From: bfoz@bfoz.net (Brandon Fosdick) Wez Furlong wrote: > Resources are the traditional approach for mapping an arbitrary > pointer to PHP space, managing its lifetime safely. > > PHP 5 OO support allows for similar things, but maps the pointer as a > PHP object. > > They're similar in some ways, but different in others. The biggest > functional difference (aside from OO) is that you can't create > persistent objects (ala mysql_pconnect())--you have to use resources > for that. > > It's usually faster to write a procedural extension using resources > than it is to write an OO extension using PHP 5 objects, although the > latter can be more accessible to the consumers of your extension. > > Resources: work with PHP 4. Can be persistent. > Objects: work with PHP 5 and up. > > There is no hard and fast rule about which one you choose; just use > the one the makes most sense for the task at hand. ah, much clearer now, thanks.