Saturday, June 13, 2026
HomeLanguagesPHP get_loaded_extensions() Function

PHP get_loaded_extensions() Function

The get_loaded_extensions() is an inbuilt function that returns an array of loaded and compiled modules in PHP.

Syntax:

get_loaded_extensions(bool $zend_extensions = false):

Parameters: This function has only one parameter.

  • $zend_extensions: It only returns zend extensions, if not then regular extensions, like MySQLi are listed. It defaults to “false” (return regular extensions).

 

Return Values:

Example 1: The following code snippet demonstrates the get_loaded_extensions() function.

PHP




<?php
   print_r(get_loaded_extensions());
?>


Output:

Array
(
   [0] => Core
   [1] => date
   [2] => libxml
   [3] => openssl
   [4] => pcre
   [5] => zlib
   [6] => filter
   [7] => hash
   [8] => json
   [9] => pcntl
   [10] => Reflection
   [11] => SPL
   [12] => session
   [13] => standard
   [14] => sodium
   [15] => mysqlnd
   [16] => PDO
   [17] => calendar
   [18] => ctype
   [19] => exif
   [20] => FFI
   [21] => fileinfo
   [22] => ftp
   [23] => gettext
   [24] => iconv
   [25] => mysqli
   [26] => pdo_mysql
   [27] => Phar
   [28] => posix
   [29] => readline
   [30] => shmop
   [31] => sockets
   [32] => sysvmsg
   [33] => sysvsem
   [34] => sysvshm
   [35] => tokenizer
   [36] => Zend OPcache
)
              

Example 2: The following code snippet demonstrates the get_loaded_extensions() function.

PHP




<?php
   print_r(get_loaded_extensions(true));
?>


Output:

Array
(
   [0] => Zend OPcache
)     

Reference: https://www.php.net/manual/en/function.get-loaded-extensions.php

RELATED ARTICLES

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS