PHPackages                             cnp/php-utilities - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cnp/php-utilities

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cnp/php-utilities
=================

Generic PHP functions for standardized data manipulation.

v1.0.0(8y ago)0861MITPHPPHP &gt;=5.3.3

Since May 2Pushed 8y ago2 watchersCompare

[ Source](https://github.com/Clark-Nikdel-Powell/PHP-Utilities)[ Packagist](https://packagist.org/packages/cnp/php-utilities)[ Docs](https://github.com/Clark-Nikdel-Powell/PHP-Utilities)[ RSS](/packages/cnp-php-utilities/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)DependenciesVersions (15)Used By (1)

PHP-Utilities
=============

[](#php-utilities)

Generic PHP functions for data manipulation.

Functions
---------

[](#functions)

### getAcfFieldsAsArray

[](#getacffieldsasarray)

Gets a bunch of specific ACF fields at once. Especially useful for option page settings, which only have a way to get one field at a time.

#### Parameters

[](#parameters)

`$fields_names_arr` (array|required): An array of the field names.

`$option` (boolean|optional): Set to true if the fields are from an options page.

#### Return Values

[](#return-values)

`$data_arr` (array): Data array keyed to the field names from the input array.

### multidimensionalArrayMap

[](#multidimensionalarraymap)

Like array\_map, but for multidimensional arrays.

#### Parameters

[](#parameters-1)

`$function` The callback function to apply to each value of the array

`$array` The multi-dimensional array

#### Return Values

[](#return-values-1)

(array) The formatted array.

### parseClassesAsArray

[](#parseclassesasarray)

Take a string or array of classes, trim them and then return classes as an array.

#### Parameters

[](#parameters-2)

`$classes` (required): An flat array or comma-delimited string of classes.

#### Return Values

[](#return-values-2)

(boolean or array) If the formatted array is empty, returns false. Otherwise, returns array of classes.

### printOnPresent

[](#printonpresent)

Like the proverbial weasel, this function pops out markup if data is present. It's a more efficient way of doing an `if ( '' !== $data )` or `if ( !empty( $data ) )` check: 3 lines for the price of one!

If you pass in a function name, the function will be executed. You can use anonymous functions too!

#### Usage

[](#usage)

```
