Current Location: Home> Latest Articles> What Fields Does mysqli::$server_info Return and How to Parse Them?

What Fields Does mysqli::$server_info Return and How to Parse Them?

gitbox 2025-09-17
<span class="hljs-meta"><?php<br>
// Irrelevant output at the beginning of the article<br>
echo "This is irrelevant output at the beginning of the article\n";<br>
echo "Some debug information or welcome messages can be placed here\n";<br>
<?></p>
<hr>
<p><?php<br>
// Article main content begins<br>
echo "<h1>What Fields Does mysqli::$server_info Return and How to Parse Them?</h1>";</p>
<p>// Main content<br>
echo <span><span class="hljs-string">"<p;When using PHP's <code>mysqli
";
echo "";
echo "

3. Parsing Additional Information

"
;
echo "-log or -MariaDB. You can check this using strpos or regex:

"
;
echo "
if (strpos($serverInfo, 'MariaDB') !== false) {<br>
echo "This is a MariaDB database";<br>
} else {<br>
echo "This is a MySQL database";<br>
}<br>
"
;
echo "";
echo "

Conclusion

"
;
echo "mysqli::$server_info provides the database server version information, mainly including the major, minor, and patch numbers, as well as possible additional info. Using regular expressions or string functions, you can flexibly parse this information to help your application determine the version and type.

"
;
?>