Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

php help

Status
Not open for further replies.
Joined
Mar 13, 2005
Posts
4,662
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.

Rule #1: Be Respectful

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

Members online

No members online now.

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Siusaidh AcornBot:
    Siusaidh has left the room.
      Siusaidh AcornBot: Siusaidh has left the room.
      Top Bottom