I’m having this weird issue where after I located a number using regular expressions, I can’t convert it to an integer without it reading as 0.
//this code in php
//do next row
$team_reb=$items2[5]->children($row+1)->children(5)->innertext;
//row is an integer, items2 is an array gotten from a find() call
//gives me this in html
<span class="nbaGIScrTot">team rebs:</span> 12
I give the html because I don’t know if the tags are messing things up.
//this in php
preg_match('/team rebs:(.+)/',$team_reb,$matches,PREG_OFFSET_CAPTURE);
print_r($matches);
$team_reb=$matches[1][0];
echo gettype($team_reb).$team_reb."<br>";
//gives me this in html
Array
(
[0] => Array
(
[0] => team rebs:</span> 12
[1] => 26
)
[1] => Array
(
[0] => </span> 12
[1] => 36
)
)
string</span> 12
I’ve tried a bunch of different regular expressions, including stuff with (\d\d) inside to try and get the number, but for whatever reason it doesn’t find the number. I noticed the </span> stuff as well, and when I added that in before the (.+) part, it ended up giving me like 5-17 or something which is a completely different statistic on the table. If I try and convert the variable to an int before echoing it, it returns as 0 (and says the type is an integer with no warnings). This regular expression stuff can be confusing sometimes.
I’m open for ideas.