Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #2273
| From | Allodoxaphobia <knock_yourself_out@example.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: use of substring in php |
| Date | 2011-06-21 12:36 +0000 |
| Message-ID | <slrnj01436.snb.knock_yourself_out@shell.config.com> (permalink) |
| References | <27917623-6bef-416e-8ce3-856e9dd20bd9@v10g2000yqn.googlegroups.com> <itopa4$hj3$1@dont-email.me> |
On Mon, 20 Jun 2011 20:40:40 -0400, Bill B wrote: > On 6/20/2011 5:19 PM, Co wrote: >> >> I want to cut down the name of the user to 10 characters so it will >> fit to the picture of the user. >> At this moment I use $firstnameCut = substr($firstname, 0, 10); >> However sometimes the name is like: >> >> Johannes Paul. >> with my code it will show: Johannes P >> >> How can I change this so if the second or third name doesn't fit >> within the 10 characters >> it will not be shown at all? > > This is not a PHP answer per se. Give some though to using the first X > characters from the first name and the first Y characters from the last > name. It may resolve some of your dilemma. > It has a favorable side > effect of producing a decently unique set of characters (most of the time). And, an 'interesting' side effect of sometimes producing fairly vulgar character strings... Jonesy
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
use of substring in php Co <vonclausowitz@gmail.com> - 2011-06-20 14:19 -0700
Re: use of substring in php Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-06-20 23:04 +0000
Re: use of substring in php Bill B <me@privacy.net> - 2011-06-20 20:40 -0400
Re: use of substring in php Allodoxaphobia <knock_yourself_out@example.net> - 2011-06-21 12:36 +0000
Re: use of substring in php dougatmilmacdotcom@example.com (Doug Miller) - 2011-06-21 00:41 +0000
Re: use of substring in php bobmct <bobm3@worthless.info> - 2011-06-20 21:16 -0400
Re: use of substring in php Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spamyourself.com> - 2011-06-21 11:04 +0200
csiph-web