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
https://forums.phpfreaks.com/topic/233904-strpos/
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
https://forums.phpfreaks.com/topic/233904-strpos/#findComment-1202376
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
https://forums.phpfreaks.com/topic/233904-strpos/#findComment-1202411
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.