资 源 简 介
The resource data type was created in PHP 3 to compensate the lack of objects. PHP programmer can not create the resource himself, only some functions return it. Programmer also can not use the resource differently then to pass it to some functions.
A more natural concept for resources are objects. Functions returning the resource would be constructors of the objects, functions manipulating with the resource would be methods of these objects.
This project replaces the resource data type in PHP by classes.
$mysql = MySQL::connect();$result = $mysql->query("SELECT 1");while ($row = $result->fetchAssoc()) { echo $row[1];}
php-resource allows to serialize() and var_export() Resource classes which is not possible with plain resources.
The library requires PHP 5.3+.