You are here: Re: String Manipulation Question « All PHP « IT news, forums, messages
Re: String Manipulation Question

Posted by MattMika on 04/26/06 22:29

On Wed, 26 Apr 2006 12:53:26 -0500, "robert"
<ab@no.spam-alama-ding-dong> wrote:

>the key is the length of characters after the starting point...you're
>telling it to grab the next 43 characters that follow position 36. have a
>look:

Ahhh! I knew that, but wasnt paying ATTN. Here's what I came up with:

$string = "United Parcel Service (1 x 0.55lbs) (Ground):";
$start = strrpos($string, '(');
$end = strrpos($string, ')');
$span = ($end - $start);
$editstring = substr($string, ($start + 1), ($span - 1));
echo "<i>Edited String : </i>" . $editstring;

now it returns

Ground

Just like I wanted. Is there a more elegant way to do this?

Thanks robert,
Matt Mika

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация