(Since this function wasn't documented as of the date I left this note...)
If you came here looking for documentation, allow me to point you instead to a section in the user manual about garbage collection that includes a bit at the end about when you would use this feature and what it will actually do: http://php.net/manual/en/features.gc.collecting-cycles.php
Hope it helps!
PHP.mk документација
gc_collect_cycles
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
Патека
function.gc-collect-cycles.php
Локална патека за оваа страница.
Извор
php.net/manual/en
Оригиналниот HTML се реупотребува и локално се стилизира.
Режим
Прокси + превод во позадина
Кодовите, табелите и белешките остануваат читливи во истиот тек.
Референца
function.gc-collect-cycles.php
gc_collect_cycles
Референца за `function.gc-collect-cycles.php` со подобрена типографија и навигација.
gc_collect_cycles
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
gc_collect_cycles — Присилува собирање на сите постоечки циклуси за отпад
Параметри
Оваа функција нема параметри.
Вратени вредности
Враќа број на собрани циклуси.
Белешки од корисници 2 забелешки
Мејсон ¶
пред 14 години
jab_creations на yahoo точка com ¶
2 месеци пред
I haven't properly confirmed though a lot of people are saying PHP doesn't run garbage collection (e.g. clearing out expired session files) on localhost. Also if this has changed I don't know the old/new version cut-off either.
If this is true then you need to first determine if the client (who you should always verify, never trust) has sent the HTTP_HOST request header. If so, there are the three basic values that you'll see unlike on a live server (you'll instead see something like 'www.example.com' or 'example.com'). Don't forget about modifications you've made on your OS's hosts file (or equivalent). Don't forget any relevant networking/router/modem settings too, again, if applicable.
You could append this to your custom local homepage, setup a maintenance page or if you're running a template system append this after the XML/HTML has been sent though you very likely don't want extra stuff running on your live server only intended for your local server unless you do it after flushing the page and continue processing afterwards:
<?php
if (isset($_SERVER['HTTP_HOST']) && in_array($_SERVER['HTTP_HOST'], array('127.0.0.1','::1','localhost'))
{
gc_collect_cycles();
}
?>