Example 1 — Read Link Counts
Call mysqli_get_links_stats() and print common keys from a fixed sample.
<?php
$links = mysqli_get_links_stats();
echo "total=", $links["total"], PHP_EOL;
echo "active_connections=", $links["active_connections"], PHP_EOL; How It Works
- No connections have been opened yet in the sample.
- get_links_stats() returns the mysqlnd link array.
- total and active_connections are both 0 here.
- Opening a mysqli link raises these counts.

