PHP HELP: take out string xmlns

Discussion in 'PHP' started by digitanay, Jan 20, 2011.

  1. #1
    i have a variable $str whose print_r gives
    
    <string xmlns="http://xxxx.com/xx/xx/Serialization/">This is my string</string>
    Code (markup):
    i want to build a variable $str2 which whould be equal to = "This is my string"
    (removing the string tags..)

    how can i build my $str2..

    i tried preg_replace but was somehow not getting it,. may be due to regex error,. tgough my regex is good

    can some one gives the required lines of code,. is there a better and faster way than preg_replace.
     
    digitanay, Jan 20, 2011 IP
  2. hogan_h

    hogan_h Peon

    Messages:
    199
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    $str = '<string xmlns="http://xxxx.com/xx/xx/Serialization/">This is my string</string>';
    	
    $rslt = strip_tags($str);
    	
    echo $rslt;
    
    PHP:
     
    hogan_h, Jan 20, 2011 IP