Avatar of orik7
orik7

asked on 

Find first charcter in a list of names - PHP

Hello.
i didn't have enought words in the question title to explian all so :
i have a list of names (50-100) and they are orders in ABC. i would like to make each first name for every ABC letter in bold for exaple :
-bold- avi -bold-
ami
alon
-bold- benad -bold-
bilu
bla
---
that is in php 4.3 and my knowladge is poor.
thanx in advance. ori.
PHP

Avatar of undefined
Last Comment
ddrudik
Avatar of JurgenvH
JurgenvH
Flag of Netherlands image

is the list in a string, a file or an array?
Avatar of mankowitz
mankowitz
Flag of United States of America image

Assume your list is in $names:

foreach ($n as $names)
{
$firstletter = substring($n, 0, 1);
if ($lastone != $firstletter) print "-bold- $n -bold- \n";
else print "$n\n";
$lastone = $firstletter;
}
ASKER CERTIFIED SOLUTION
Avatar of ddrudik
ddrudik
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of orik7
orik7

ASKER

was very easy adding to script and working great. thanx.
Avatar of ddrudik
ddrudik
Flag of United States of America image

Thanks for the question and the points.
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo