Re: resources vs objects?

From: Date: Mon, 01 May 2006 21:18:31 +0000
Subject: Re: resources vs objects?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-23068@lists.php.net to get a copy of this message
Hi, Brandon Fosdick wrote:
From the point of view of an extension, what's the difference between a resource and an object? Is there any reason to favor one over the other?
sqlite seems to use resources for the procedural interface and objects otherwise. Whereas mysqli uses objects all around in user space, but then maps them to resources in the background. Why use objects only to map them to resources? Are resources somehow special?
mysqli does not use resources at all. Even in the procedural interface, the "resources" are just objects. Thus, procedural and OO code can be mixed, for those wanting to write spaghetti code or for legacy and non-legacy code. $c = mysqli_connect(....); $r= $c->query(); ... Cheers, Andrey

« previous php.internals (#23068) next »