Thanks John, Works a treat.
Thank You Dave Carrera -----Original Message----- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: 07 May 2004 12:32 To: Dave Carrera Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Showing only part of string Dave Carrera wrote: > $string = "This is a test string to <title>SHOW ONLY THIS BIT</title> > of the string"; > > I have tried strpos, str_replace and other string manipulation things > but I cant get my head around how to achieve showing the text with the > <title></title> tags of the string. > > Any help is appreciated and I thank you in advance for any help given. $b = strpos($str,'<title>')+7; $l = strpos($str,'</title>') - $b; $m = substr($str,$b,$l); Sure, you can use regular expressions, but there's not really a need unless this gets more complex. Even though you're executing more code with this solution, it'll be faster than preg_match() (go ahead and benchmark it). -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.677 / Virus Database: 439 - Release Date: 04/05/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.677 / Virus Database: 439 - Release Date: 04/05/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php