# resources vs objects?

- Thread: https://externals.io/message/23047
- Original archive: https://news-web.php.net/php.internals/23047
- Started by Brandon Fosdick on 2006-04-30T05:20:26+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #23047 — Brandon Fosdick — 2006-04-30T05:20:26+00:00

URL: https://externals.io/message/23047#23047

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?

---

## #23048 — Brandon Fosdick — 2006-04-30T05:24:41+00:00

URL: https://externals.io/message/23047#23048 · In reply to: #23047

Brandon Fosdick wrote:
> > […]
> 
> 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?
> 

Sorry for the double post. Thunderbird suddenly went crazy...and seems to have taken firefox with it. I don't know why one part is quoted either, that really should have been a single original message. Sorry about that.

---

## #23068 — Andrey Hristov — 2006-05-01T21:18:31+00:00

URL: https://externals.io/message/23047#23068 · In reply to: #23047

Hi,
Brandon Fosdick wrote:
> > […]
> 
> 
> 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
