Thursday, November 20, 2025
HomeLanguagesPHP | Imagick destroy() Function

PHP | Imagick destroy() Function

The Imagick::destroy() function is an inbuilt function in PHP which is used to destroy the Imagick object and free all the resources associated with it. You can’t access your object content once it is destroyed.

Syntax:

bool Imagick::destroy( void )

Parameters: This function does not accept any parameters.

Return Value: This function returns TRUE on success.

Below program illustrates the Imagick::destroy() function in PHP:

Program:




<?php
  
// Create a new imagick object with image
$imagick = new Imagick(
  
// Use your $imagick object for whatever you want 
// to do here and destroy it after using it.
  
// Destroying that object
$imagick->destroy();
?>


Output: Since image distroyed so it will not display any image.

Reference: https://www.php.net/manual/en/imagick.destroy.php

RELATED ARTICLES

Most Popular

Dominic
32404 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6775 POSTS0 COMMENTS
Nicole Veronica
11924 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11994 POSTS0 COMMENTS
Shaida Kate Naidoo
6903 POSTS0 COMMENTS
Ted Musemwa
7159 POSTS0 COMMENTS
Thapelo Manthata
6859 POSTS0 COMMENTS
Umr Jansen
6846 POSTS0 COMMENTS