I'm just trying to deepen my understanding of the resource type, and I'm not really sure why it was invented in the first place.
From my experience, architecturally, you only ever send resources around as dependencies for other functions in the same operation in which you're executing, but you will never send that resource to a separate part of your program. Surely just a standard object would suffice?
Am I missing something? What is a resource / how should it be used?
Before PHP 5, objects had by-value semantics. I.e., you passed them around like structs and their data were copied. That wouldn't have worked for something like a database or file handle. I'd guess that's why these resources were a distinct type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With