imagedestroy 


gd apg

DESTROY a particular resource associated with an image freeing it for reuse in the same application.


In PHP 8.0.0 or higher this function has no effect.
Prior to PHP 8.0.0, this function was used to close the resource.





When the application stops, PHP automatically destroys any identifier.



<?php

bool imagedestroy 
( GdImage $image )

where,

$image = An image identifier

?>

  $image   


An image identifier.



  1 EXERCISE   

<?php

/*

   This exercise does not display any image, 
   it just displays the identifier: 
                      resource or object
   
   This will be displayed using another function
   
   So be patient!
   
   RUN this exercise to see the result

*/

$w01a = 100;

$h01a = 100;

$w01b = 120;

$h01b = 120;   

$img0101a = imagecreate( $w01a, $h01a );

$img0101b = imagecreatetruecolor( $w01b, $h01b );

$img0101c = imagecreate( $w01a, $h01a );

$img0101d = imagecreatetruecolor( $w01b, $h01b );

$imgd01 = imagedestroy($img0101a);

$imgd0b = imagedestroy($img0101b);

var_dump($img0101a);

echo 
'<br><br>';

var_dump($img0101b);

echo 
'<br><br>';

var_dump($img0101c);

echo 
'<br><br>';

var_dump($img0101d);

?>