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,661
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.
General chit-chat
Help Users
  • No one is chatting at the moment.
      Helmuts @ HelmutsHelmuts is verified member.: Good morning all
      Top Bottom