Question

I am trying to use substr function in PHP for the below html string

<HR><CENTER><B>References <a href="aaaa">[Referenced By]</A></B></CENTER>       <HR>
         <CENTER><b>Documents</b></CENTER>
<TABLE WIDTH="100%"> <TR><TH scope="col" WIDTH="33%"></TH> <TH scope="col" WIDTH="33%"></TH> <TH scope="col" WIDTH="34%"></TH></TR> <TR> <TD ALIGN="left">

$html is the variable that includes the string above, and my code as below

$ints = strpos($html,"<b>Documents</b></CENTER>");
$ii=strlen("<b>Documents</b></CENTER>");

echo substr($html,$ints + $ii+2,7);

this is working very well with me and I got result

TABLE W 

but when I tried to write the echo as below I have a blank page with no errors

echo substr($html,$ints + $ii,7);

any suggestion what is wrong? is the starting of the new line is the reason? appreciate your help and if you have any solution.

Was it helpful?

Solution

You're not getting a blank page. You're probably getting a rendered HTML page that happens to contain <TABLE. Do a 'view source' to confirm.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top