WordPress plugin intelligence profile

Array Partition

Provides a helper function to split an array into N number of evenly distributed partitions (i.e. split a list into N columns)

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 7.1
Current version2.0
WordPress coverageTested up to WordPress 7.1
Minimum stackWP 5.0 · PHP 7.0
Directory statusactive
Last directory update26 Oct 20267d ago
Active installations10Adoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Array Partition version 2.0 as active, updated 7d ago and tested up to WordPress 7.1.

Overview

About this plugin

This plugin provides the PHP function c2c_array_partition() to split an array into any number of sub-arrays, suitable for creating evenly distributed, vertically filled “columns”. Also known as “chunking” or “partitioning”.

For example:

$topics = array( "ant", "bear", "cat", "dog", "emu", "fox", "gnu", "hog", "ibis", "jackal" ); print_r( c2c_array_partition( $topics, 4 ) );

Yields:

Array ( [0] => Array ( [0] => ant [1] => bear [2] => cat )

[1] => Array ( [0] => dog [1] => emu [2] => fox )

[2] => Array ( [0] => gnu [1] => hog )

[3] => Array ( [0] => ibis [1] => jackal ) )

Note the array elements are distributed into the requested 4 “columns” as evenly as possible.

The function will fill as many partitions as requested, as long as there are enough elements in the array to do so. Any remaining unfilled partitions will be represented as empty arrays.

In contrast, using PHP’s built-in array_chunk() as such:

print_r( array_chunk( $topics, 4 ) );

Yields:

Array ( [0] => Array ( [0] => aardvark [1] => bear [2] => cat [3] => dog ) [1] => Array ( [0] => emu [1] => fox [2] => gnu [3] => hippo ) [2] => Array ( [0] => ibis [1] => jackal ) )

It can be sent an array of any data types or objects.

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

Examples

>

=>

Array ( [0] => Array ( [0] => ant )

[1] => Array ( [0] => bear )

[2] => Array ( [0] => cat )

[3] => Array ( )

[4] => Array ( ) )

Also see Description section for another example. Definitely check out the unit test file in the GitHub repository as it contains various examples (see FAQ).

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • array
  • chunk
  • coffee2code
  • columns
  • partition
Compatibility & maintenance

Compatibility & maintenance

Tested with WP 7.1

Marked as tested with the current WordPress 7.1 release.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to7.1
Minimum requirementsWordPress 5.0 · PHP 7.0
Update activity26 Oct 20267d ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

Version1.3.52.0
WordPress compatibility6.8.87.1.3
WordPress requirement1.25.0
PHP requirementNot listed7.0
Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.