Regex & PHP - isolate src attribute from img tag -


With PHP, how can I separate the content of src attribute from $ Foo? The end result is just "me"

  $ foo = '& lt; Img class = "foo bar test" heading = "test image" src = "http: / /example.com/img/image.jpg" alt = "test image" width = "100" height = "100" /> ; ';  

If you do not want to use regex (or any non-standard PHP components) ), A proper solution using the built-in will be as follows:

  ); $ ImageTags = $ doc- & gt; GetElementsByTagName ('IMG'); Forex Currency ($ imageTags as $ Tag) {echo $ tag-> GetAttribute ('src'); }? & Gt;  

Comments

Popular posts from this blog

asp.net - Change the driver in the connection string to a data source in VB.Net -

Getting started consuming web services in a Ruby on Rails 3 application -

objective c - iPhone and it's wireless area -