gc_enable example

return false;
        });
        $this->filter = $filter;

        if ($gc = gc_enabled()) {
            gc_disable();
        }
        try {
            return new Data($this->doClone($var));
        } finally {
            if ($gc) {
                gc_enable();
            }
            restore_error_handler();
            $this->prevErrorHandler = null;
        }
    }

    /** * Effectively clones the PHP variable. */
    abstract protected function doClone(mixed $var): array;

    
$gcEnabledAtStart = gc_enabled();
        if ($gcEnabledAtStart) {
            gc_collect_cycles();
            gc_disable();
        }

        $dompdf->render();

        $this->injectPageCount($dompdf);

        if ($gcEnabledAtStart) {
            gc_enable();
        }

        return (string) $dompdf->output();
    }

    /** * Replace a predefined placeholder with the total page count in the whole PDF document */
    private function injectPageCount(Dompdf $dompdf): void
    {
        /** @var CPDF $canvas */
        
return false;
        });
        $this->filter = $filter;

        if ($gc = gc_enabled()) {
            gc_disable();
        }
        try {
            return new Data($this->doClone($var));
        } finally {
            if ($gc) {
                gc_enable();
            }
            restore_error_handler();
            $this->prevErrorHandler = null;
        }
    }

    /** * Effectively clones the PHP variable. */
    abstract protected function doClone(mixed $var): array;

    
Home | Imprint | This part of the site doesn't use cookies.