Jump to content

strpos


JamesThePanda

Recommended Posts

Hi

Im having a problem finding the posistion of a div tag I tried this piece of code

 

$fpos= strpos($snip, "<div id=\"footer\">")

 

Then this piece

 

$fpos= strpos($snip, "<div id="footer">")

 

The $snip is the entire html document

 

I thought maybe the \ might be causeing problem but without it

 

Then i tried this

 

any suggestions guys

 

Thanks

 

James

Link to comment
Share on other sites

Are you 100% for sure that "$snip" has the correct values in it?

 

Try echoing $snip to the screen and see what you get.

 

Also try a find of just "$fpos= strpos($snip, "<div id="); and see what you get.

 

Finally can you echo $fpos to the screen AFTER  you do the search and see what it actually says?  Echo to the screen is one of the best way to debug something.

Link to comment
Share on other sites

Hi Cunoodle

 

For some reason its starte working now I been playing wit it for a hour or so. I think the problem was i was getting the data from a file and looking for several tags all at once.

I just split them up a bit and thats seems to work :)

 

Thanks SO much for you help

 

James

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.