From: Jason Woofenden Date: Fri, 27 Mar 2015 19:40:55 +0000 (-0400) Subject: format_varname: contract contractions X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=a12dac7f5211f0d5ef7e1dd36466399026255e6b format_varname: contract contractions --- diff --git a/format.php b/format.php index c913864..81878eb 100644 --- a/format.php +++ b/format.php @@ -173,6 +173,7 @@ function format_slug($str) { function format_varname($str) { $str = preg_replace("/([a-z])([A-Z])/", "\\1_\\2", $str); # split words on camelCase $str = strtolower($str); + $str = preg_replace("/['‘’]/", '', $str); $str = preg_replace('/[^a-z0-9_]+/', '_', $str); return preg_replace('/^([^a-z_])/', "_\\1", $str); }