RE: [PHP] Converting a string
| From: | Jay Blanchard | Date: | Fri, 17 Mar 2006 19:21:12 +0000 |
| Subject: | RE: [PHP] Converting a string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-232154@lists.php.net to get a copy of this message | ||
[snip]
Then you should change the name of the field. Seriously, what
do you
expect the script to do, exactly? and once you know the answer, what
would you do to achieve that? Put that (emphasis to the second
question) in words and someone might be able to help you.
[/snip]
I expect that I can take a string, like 'psFirstName' and change it to
'First Name'. that way I don't have to worry about what some web
designer named his fields, I can turn them into human readable strings
without having to manually create a new array.
So far I have this
$newKey = preg_split("/([A-Z])/", substr($key, 2), -1,
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
Which returns;
Array
(
[0] => F
[1] => irst
[2] => N
[3] => ame
)