Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.

php help

Status
Not open for further replies.
Joined
Mar 13, 2005
Posts
4,694
Reaction score
186
Hi, can anyone tell me how to do this in php please:

I want to remove all characters (or replace with '') from the left of a string, up to and including the first fullstop? There could be any number of characters before the fullstop.


Thanking you

Grant
 
Several ways to do it really, but this is going to be the fastest CPU wise:

<?php
$string = "this is a test. We only want this one.";
$new_string = trim(substr($string,strpos($string,'.')+1,strlen($string)));
echo $new_string;
?>


The trim() function will remove any spaces after the first '.', once it's been cut!

Jee
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Featured Services

Sedo - it.com Premiums

IT.com

Premium Members

AucDom
UKBackorder
Be a Squirrel
Acorn Domains Merch
MariaBuy Marketplace

New Threads

Domain Forum Friends

Other domain-related communities we can recommend.

Our Mods' Businesses

Perfect
Service
Laskos
*the exceptional businesses of our esteemed moderators
Top Bottom