I have a string, that contains multiple values, and has a prefix of ***. Here's an example:

$value = 'a.first_name, a.last_name, a.address, a.city, a.state, b.phone_num, bc.gender, vfr.rating';

// instead, I'd like for it to display like this

$value = 'first_name, last_name, address, city, state, phone_num, gender, rating';

Basically, I'd like to remove the "." and everything that comes before it for each element.

As you can see, the prefix may contain 1-n characters to remove.

How might I accomplish this?

Thanks in advance!

-E

there are a few ways to do it
use explode() to split by a comma and space, strpos() to find the position of of the period, and substr() to only get the data after that position.
or, you can use regular expresions and preg_replace(), something like '[a-z]\.(.*),? ?' would probably do it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.