Jump to content

[SOLVED] Help removing characters after two letters have occurred


closet geek

Recommended Posts

Say I have these test strings:

 

Test ThingPL324jbkbDSfNKnasdfdkjn324fNJFDjkn

Another TestPL324jbkbDSfNKnasdfdkjn324fNJFDjkn

 

and I want to remove anything that starts with PL* (including PL itself) so I'm left with:

 

Test Thing

Another Test

 

How would I do that?

 

Thanks.

The explode example should work fine...

 

Except I think it might need to be (and there's an extra step):

 

$text = 'Test ThingPL324jbkbDSfNKnasdfdkjn324fNJFDjkn';
$explode = explode("PL", $text);
$text = $explode[0];
echo $text;
//Test Thing

The explode example should work fine...

 

Except I think it might need to be (and there's an extra step):

 

$text = 'Test ThingPL324jbkbDSfNKnasdfdkjn324fNJFDjkn';
$explode = explode("PL", $text);
$text = $explode[0];
echo $text;
//Test Thing

 

Thank you! That works perfectly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.