While there's a number of organisations that dedicate resources to determining the breakup of PHP's version usage, WordPress maintain their own statistics. Based on their massive coverage, WP's broad reach provides a scientifically and statistically sound source of version data. This article will provide the necessary shortcode to retrieve the WP data and render it into a Google pie chart. The shortcode can also be used to retrieve MySQL and WordPress version usage. See graphs as we've used them on our reference page.
We generally use our own graphing utilities but we'll often revert back to Google charts for more sophisticated renderings.
The result of the shortcode
[phpversions] is as follows:
At the time of writing, version 5.6 tends to dominate the space with the build representing nearly 40% of all installations.
To generate a donut chart representing WordPress version usage, use a piehole value between 0 and 1 as an attribute (0 is the default, meaning no hole). We'll also specify a name to avoid element ID conflicts and provide a title. For example,
[phpversions piehole="0.4" type="wordpress" name="wp_piehole" title="WordPress Version Usage (source: WordPress)"]. The result:
For the last example we'll render the MySQL chart in 3d. Shortcode of
[phpversions name="mysql_threed" type="mysql" 3d="true" title="MySQL Version Usage (source: WordPress)"] returns:
Copy and paste the WordPress function into your theme's
functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.
typeof chart: php, mysql, or wordpress.
nameof the chart. This is the div ID so isn't visible in your browser.
title. Include WordPress as a source.
piehole="0.4"seems to work well. A value of 0 will omit the piehole completely.
A PHP function to be used outside of WordPress is available for download below. Usage requires our Simple Cache. Arguments are passed to the function as an array. Default usage renders a PHP chart.
- This shortcode was provided just to demonstrate example usage of live data. Consider it in the marketing realm to measure the success of certain campaigns, clicks against campaign URLs or individuals, sales performance etc.
- When the 3d chart is rendered the piehole feature is unavailable.
- A large number of pie chart features are available. Details here