How to check if GD library is installed in PHP?

I need to know if the GD library is installed on my server. I am working on a PHP project, and some functions require the GD library for image processing. How can I check if the GD library is installed in my PHP environment?

To check if the GD library is installed in your PHP environment you can try this 2 function.

phpinfo();

Or try this function in if condition. This will return true or false.

extension_loaded('gd')