You are here

function checklistapi_strtolowercamel in Checklist API 7

Same name and namespace in other branches
  1. 8 checklistapi.module \checklistapi_strtolowercamel()

Converts a string to lowerCamel case, suitably for a class property name.

Parameters

string $string: The input string.

Return value

string The input string converted to camelCase.

2 calls to checklistapi_strtolowercamel()
ChecklistapiChecklist::__construct in lib/Drupal/checklistapi/ChecklistapiChecklist.php
Constructs a ChecklistapiChecklist object.
ChecklistapiUnitTestCase::testChecklistapiStrtolowercamel in tests/checklistapi.test
Test checklistapi_strtolowercamel().

File

./checklistapi.module, line 268
An API for creating fillable, persistent checklists.

Code

function checklistapi_strtolowercamel($string) {
  $string = str_replace('_', ' ', $string);
  $string = ucwords($string);
  $string = str_replace(' ', '', $string);

  // Lowercase first character. lcfirst($string) would be nicer, but let's not
  // create a dependency on PHP 5.3 just for that.
  $string[0] = strtolower($string[0]);
  return $string;
}