Hello all,
I know that this has probably been discussed before and that you will
tell me to go through all the back messages on the list but I really
don't have time to do that because I am on a really tight schedule, but
I was wondering if anyone could give me some pointers on how to pull
some information out of a string. I have something like this:
(Something) - is wrong with me
or
something - (is wrong with me)
or 
something - (is wrong with me

what I need to know how to do is take the stuff that is inside the
Brackets (or partial brackets) and put them into another string
the way I am currently doing it is like this:
Variable names have been changed per my boss(My Boss wanted me to change
them for some reason)
<?
$parenpos = strpos($tartist,")");
$bracketpos = strpos($tartist,"]");
if($parenpos){
        $artist = trim(substr($tartist,0,$parenpos));
        $title  = trim(substr($tartist,$parenpos+3));
        $secondparenpos = strpos($title,"(");
        $secondbracketpos = strpos($tartist,"[");
        $title = trim(substr($title,0,$secondparenpos));
        }elseif($bracketpos){
                $artist = chop(substr($tartist,1,$bracketpos-1));
                $title  = trim(substr($tartist,$bracketpos+3));
}
?>

I know that there has to be a shorter version of this, can anyone help
me out with it?

Thank You,
Mike
[EMAIL PROTECTED]
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to