Hướng dẫn weakreference php
The WeakReference class(PHP 7 >= 7.4.0, PHP 8) Show IntroductionWeak references allow the programmer to retain a reference to an object which does not prevent the object from being destroyed. They are useful for implementing cache like structures. WeakReferences cannot be serialized. Class synopsisfinal class WeakReference { public get(): ?object } WeakReference ExamplesExample #1 Basic WeakReference Usage
The above example will output something similar to: object(stdClass)#1 (0) { } NULL Table of Contents
Sandor Toth ¶ 2 years ago
$app->get(); Submit a Pull Request Report a Bug (PHP 7 >= 7.4.0, PHP 8) WeakReference::create — Create a new weak reference Descriptionpublic static
WeakReference::create(object Creates a new WeakReference. Parametersobject The object to be weakly referenced. Return ValuesReturns the freshly instantiated object. +add a note User Contributed NotesThere are no user contributed notes for this page. Submit a Pull Request Report a Bug (PHP 7 >= 7.4.0, PHP 8) WeakReference::get — Get a weakly referenced Object Descriptionpublic WeakReference::get(): ?object Gets a weakly referenced object. If the object has already been destroyed, ParametersThis function has no parameters. Return Values Returns the referenced object, or +add a note User Contributed NotesThere are no user contributed notes for this page. |