glenelkins Posted January 17, 2010 Share Posted January 17, 2010 I have a string: $_str = '<a href="testing.html">Test Link</a>'; I want the starting position of the "> before the text "Test link" $_pos = strpos ( $_str, "\">" ); But its not returning a position for this...any ideas? If i do $_pos ( $_str, "href=" ) that works fine Quote Link to comment https://forums.phpfreaks.com/topic/188766-strpos-not-reading-some-chars/ Share on other sites More sharing options...
oni-kun Posted January 17, 2010 Share Posted January 17, 2010 $_str = '<a href="testing.html">Test Link</a>'; $_pos = strpos ( $_str, '">' ); echo $_pos; 21 Quote Link to comment https://forums.phpfreaks.com/topic/188766-strpos-not-reading-some-chars/#findComment-996523 Share on other sites More sharing options...
glenelkins Posted January 17, 2010 Author Share Posted January 17, 2010 this is what im saying, that doesnt seem to be working Quote Link to comment https://forums.phpfreaks.com/topic/188766-strpos-not-reading-some-chars/#findComment-996530 Share on other sites More sharing options...
oni-kun Posted January 17, 2010 Share Posted January 17, 2010 this is what im saying, that doesnt seem to be working Does that exact code, with nothing else in the file work? It's not making any sense that it's not, unless you're somehow managing to enter entities such as >.. What's your PHP version? Quote Link to comment https://forums.phpfreaks.com/topic/188766-strpos-not-reading-some-chars/#findComment-996531 Share on other sites More sharing options...
glenelkins Posted January 17, 2010 Author Share Posted January 17, 2010 ha lol its becuase i was adding the htmlentities to it Quote Link to comment https://forums.phpfreaks.com/topic/188766-strpos-not-reading-some-chars/#findComment-996535 Share on other sites More sharing options...
oni-kun Posted January 17, 2010 Share Posted January 17, 2010 ha lol its becuase i was adding the htmlentities to it There ya go! These problems are annoying when they should be working but don't. Quote Link to comment https://forums.phpfreaks.com/topic/188766-strpos-not-reading-some-chars/#findComment-996538 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.