djneel Posted November 13, 2006 Share Posted November 13, 2006 Hello everyone,How can I turn this:[code]$title = "<h2><a href="index.html">The Index Page</a></h2>";[/code]Into this:[code]$urlFromTitle = "index.html";[/code]I just don't understand the PHP manual.Thanks in advance! Quote Link to comment Share on other sites More sharing options...
blear Posted November 13, 2006 Share Posted November 13, 2006 You need the explode() command.array explode ( string delimiter, string string [, int limit] )So,[code]$title = "<h2><a href="index.html">The Index Page</a></h2>"; //This assignment statement wont work$kapow=explode('href="',$title);$secondBlast = explode('"',$kapow[1]);$urlFromTitle=$secondBlast[0];[/code]The $title assignment line wont work, so I'm guessing you have that string assigned in some other way. Quote Link to comment Share on other sites More sharing options...
djneel Posted November 13, 2006 Author Share Posted November 13, 2006 Off course, how silly of me...[code]$title = "<h2><a href=\"index.html\">The Index Page</a></h2>";[/code]Thank you very much!It worked like a charm! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.