strrpos(), bug?

From: Date: Wed, 16 Apr 2003 17:35:47 +0000
Subject: strrpos(), bug?
Groups: php.general 
Request: Send a blank email to php-general+get-144147@lists.php.net to get a copy of this message
Is strrpos() buggy or is it just me? I have a string containing of HTML-code. I want to strip everything before the last <table>. To do this I thought I could get the position of it with strrpos() and just substring() it away, but I don't get a correct response from strrpos(). The correct responce should be 75, but I get 244... it seems like it can't see any difference between <table> and </table>. Is it perhaps my PHP-version? I have 4.3.0 on a win2000-machine. <code> $myhtml = '<table> <tr> <td colspan=2> <table> <tr> <td colspan=2> <table> <tr> <td>Stuff 2</td> <td>Stuff 2</td> </tr> </td> </tr> <tr> <td>Stuff 2</td> <td>Stuff 2</td> </tr> </table>'; $table_pos = strrpos($myhtml, "<table>"); echo substr($myhtml, $table_pos); </code>

« previous php.general (#144147) next »