• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

php help

Status
Not open for further replies.
Joined
Mar 13, 2005
Posts
4,660
Reaction score
184
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.
Top Bottom