# faustwp/0.7.7/includes/utilities/functions.php

Faust.js, version 0.7.7. 35 lines.

- Page: https://pluginprobe.com/plugins/faustwp/0.7.7/code/includes/utilities/functions.php
- Raw: https://pluginprobe.com/plugins/faustwp/0.7.7/raw/includes/utilities/functions.php
- Modified: 2021-12-02T16:40:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/faustwp/0.7.7/code/includes/utilities/functions.php#L10-L20`.

```php
<?php
/**
 * Various utility functions used through the FaustWP plugin.
 *
 * @package FaustWP
 */

namespace WPE\FaustWP\Utilities;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Converts string to camelCase. Added to ensure that fields are compliant with the GraphQL spec.
 *
 * @param string $str The string to be converted to camelCase.
 * @param array  $preserved_chars The characters to preserve.
 *
 * @credit http://www.mendoweb.be/blog/php-convert-string-to-camelcase-string/
 *
 * @return string camelCase'd string
 */
function camelcase( $str, $preserved_chars = array() ) {
	/* Convert non-alpha and non-numeric characters to spaces. */
	$str = preg_replace( '/[^a-z0-9' . implode( '', $preserved_chars ) . ']+/i', ' ', $str );
	$str = trim( $str );

	/* Uppercase the first character of each word. */
	$str = ucwords( $str );
	$str = str_replace( ' ', '', $str );

	return lcfirst( $str );
}

```
