note 92092 added to function.ucwords

From: Date: Wed, 08 Jul 2009 13:42:33 +0000
Subject: note 92092 added to function.ucwords
Groups: php.notes 
Request: Send a blank email to php-notes+get-158059@lists.php.net to get a copy of this message
Some recipes for switching between underscore and camelcase naming: // underscored to upper-camelcase // e.g. "this_method_name" -> "ThisMethodName" preg_replace('/(?:^|_)(.?)/e',"strtoupper('$1')",$string); // underscored to lower-camelcase // e.g. "this_method_name" -> "thisMethodName" preg_replace('/_(.?)/e',"strtoupper('$1')",$string); // camelcase (lower or upper) to underscored // e.g. "thisMethodName" -> "this_method_name" // e.g. "ThisMethodName" -> "this_method_name" strtolower(preg_replace('/([^A-Z])([A-Z])/', "$1_$2", $string)); Of course these aren't 100% symmetric. For example... * this_is_a_string -> ThisIsAString -> this_is_astring * GetURLForString -> get_urlfor_string -> GetUrlforString ---- Server IP: 209.41.74.194 Probable Submitter: 67.204.146.243 ---- Manual Page -- http://www.php.net/manual/en/function.ucwords.php Edit -- https://master.php.net/note/edit/92092 Del: integrated -- https://master.php.net/note/delete/92092/integrated Del: useless -- https://master.php.net/note/delete/92092/useless Del: bad code -- https://master.php.net/note/delete/92092/bad+code Del: spam -- https://master.php.net/note/delete/92092/spam Del: non-english -- https://master.php.net/note/delete/92092/non-english Del: in docs -- https://master.php.net/note/delete/92092/in+docs Del: other reasons-- https://master.php.net/note/delete/92092 Reject -- https://master.php.net/note/reject/92092 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158059) next »